This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.tensorflow._ | |
object Main extends App { | |
val graph = new Graph() | |
val a = graph.opBuilder("Const", "a"). | |
setAttr("dtype", DataType.INT32). | |
setAttr("value", Tensor.create(Array(1, 2, 3))). | |
build(). | |
output(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.deeplearning4j.nn.api.OptimizationAlgorithm | |
import org.deeplearning4j.nn.conf.layers.{GravesLSTM, RnnOutputLayer} | |
import org.deeplearning4j.nn.conf.{BackpropType, NeuralNetConfiguration, Updater} | |
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork | |
import org.deeplearning4j.nn.weights.WeightInit | |
import org.nd4j.linalg.dataset.DataSet | |
import org.nd4j.linalg.factory.Nd4j | |
import org.nd4j.linalg.lossfunctions.LossFunctions.LossFunction | |
import org.slf4j.LoggerFactory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 20000 | |
in [7, 4] ASC | |
ans [4, 7] | |
out [4, 7] 1.0 | |
in [1, 6, 3] ASC | |
ans [1, 3, 6] | |
out [1, 3, 6] 1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val imp: Int = 400 | |
val yen: Int = 30 | |
val cpm: Double = yen / imp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.Writer | |
import scala.io.Source | |
object Using { | |
def apply[A, B](resource: A)(process: A => B)(implicit closer: Closer[A]): B = | |
try { | |
process(resource) | |
} finally { | |
closer.close(resource) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
from tensorflow.examples.tutorials.mnist import input_data | |
flags = tf.app.flags | |
FLAGS = flags.FLAGS | |
flags.DEFINE_integer('batch_size', 256, '') | |
flags.DEFINE_integer('epoch_num', 10, '') | |
flags.DEFINE_integer('hidden_num', 64, '') | |
flags.DEFINE_float('learning_rate', 0.01, '') | |
flags.DEFINE_float('noise_rate', 0.3, '') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.Writer | |
import scala.io.Source | |
object Using { | |
def apply[A, B](resource: A)(process: A => B)(implicit closer: Closer[A]): B = | |
try { | |
process(resource) | |
} finally { | |
closer.close(resource) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atilika.kuromoji.ipadic.{Token, Tokenizer} | |
import scala.collection.JavaConverters._ | |
import scalaz.Scalaz.ToTreeOps | |
import scalaz.{Memo, Show, Tree} | |
case class Rule(left: String, right1: String, right2: String, prob: Double) | |
case class PcfgNode(label: Either[Rule, Token], prob: Double) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main extends App { | |
val githubUrl = "https://github.com/git/git" | |
val text = "commit: " + | |
ManifestReader.gitRev.map(r => | |
"[" + r.take(7) + "](" + githubUrl + "/commit/" + r + ")" | |
).getOrElse("?") + " " + | |
ManifestReader.gitClean.map { | |
case false => "[modified]" | |
case true => "" | |
}.getOrElse("") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sbt.version=0.13.8 |