tensorflow初学者です。
model = tf.sequential() model.add(tf.layers.conv1d({filters: 64, kernelSize: 8, padding: 'same', inputShape: [64, 1], activation: 'relu'})) model.add(tf.layers.maxPooling1d({poolSize: 2, padding: 'same'})) model.add(tf.layers.conv1d({filters: 64, kernelSize: 8, padding: 'same', activation: 'relu'})) model.add(tf.layers.maxPooling1d({poolSize: 2, padding: 'same'})) model.add(tf.layers.conv1d({filters: 32, kernelSize: 8, padding: 'same', activation: 'relu'})) model.add(tf.layers.conv1d({filters: 1, kernelSize: 8, padding: 'same', activation: 'tanh'}))
のように
tf.sequential()
を使って書く方法と、
import tensorflow as tf # ランク2のテンソル(行列)の定義 x = tf.constant([[1,2], [1,2]], tf.int32, name="x") y = tf.constant([[3,4], [3,4]], tf.int32, name="y") # 行列の足し算 add_op = tf.add(x, y) with tf.Session() as sess: print(sess.run(x)) print(sess.run(y)) print(sess.run(add_op))
のように
with tf.Session() as sess:
を使って書く方法の違いがわかりません。
2種類の書き方があると言う認識でしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/11/09 07:38