import tensorflow as tf mnist = input_data.read_data_sets(“/var/tmp/mnist-softmax/”, one_hot=True) sess = tf.I…
カテゴリー: TensorFlow スニペット
TensorFlow: snippet: CSV ファイル
filename_queue = tf.train.string_input_producer([“file0.csv”, “file1.csv”]) reader = tf.TextLineReader() key, …
TensorFlow: snippet: GPU
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name=’a’) b = tf.constant([1.0, 2.0, 3.0, 4.0, 5…
TensorFlow: snippet: TensorBoard
x = tf.placeholder(tf.float32, [None, 784], name=”x-input”) W = tf.Variable(tf.zeros([784,10]), name=”weights”…
TensorFlow : snippet : 変数の作成・初期化・保存・復旧
変数の作成にはテンソルの shape を指定します。 weights = tf.Variable(tf.random_normal([784, 200], stddev=0.35), name=”weights”) bi…
TensorFlow: snippet: テンソル
変数はグラフの実行を通じて状態を保持します。次の例題は単純なカウンターとして作用する変数の例です。 import tensorflow as tf state = tf.Variable(0, name=”counter…
TensorFlow: snippet: Hello World
In [1]: import tensorflow as tf In [2]: hello = tf.constant(‘Hello, TensorFlow!’) In [3]: sess = tf.Session() …
TensorFlow: snippet: Keras
$ python -c “from keras import backend; print backend._BACKEND” Using TensorFlow backend. tensorflow 【参考】 Kera…
TensorFlow: snippet: 対話的な利用方法
対話的な Python 環境での使い勝手のために、対話的に利用する際には、InteractiveSession クラス、そして Tensor.eval() と Operation.run() メソッドを代わりに使うことに…
TensorFlow: snippet: 基本的な使い方
import tensorflow as tf matrix1 = tf.constant([[3., 3.]]) matrix2 = tf.constant([[2.],[2.]]) product = tf.matm…