1
以下は、tf.constant
の一部がtensorboard
に表示される作業コードですが、一部は表示されません。`tf.constant`が` tensorboard`に表示されないときは混乱しますか?
しかし、なぜそれらが表示されないのかわかりません。
誰でも私を助けてくれますか?ありがとう
import tensorflow as tf
import numpy as np
# tf.constant(value, dtype=None, shape=None,
# name='Const', verify_shape=False)
a = tf.constant([2, 2], name="a")
b = tf.constant([[0, 1], [2, 3]], name="b")
x = tf.add(a, b, name="add")
y = tf.multiply(a, b, name="mul")
# verify_shape=True, error if shape not match
# edge1 = tf.constant(2, dtype=None, shape=[2,2], name="wrong_shape", verify_shape=True)
# verify_shape=False, if shape not match, will add to match
edge2 = tf.constant(2, dtype=None, shape=[2,2], name="edge2", verify_shape=False)
# increase row by row, from left to right
edge3 = tf.constant([1,2,3,4], dtype=None, shape=[4,3], name="edge3", verify_shape=False)
# reassign works
edge2c = edge2
edge3c = edge3
edge4 = tf.constant(np.ones((2,2)), dtype=None, shape=None, name="shape22", verify_shape=False)
# increase row by row, from left to right
edge5 = tf.constant(np.ones((4,3)), dtype=None, shape=[4,3], name="shape43", verify_shape=False)
with tf.Session() as sess:
writer = tf.summary.FileWriter('./log/01_tf', sess.graph)
x, y = sess.run([x, y])
sess.run(edge4)
sess.run(edge5)
sess.run(edge2c)
sess.run(edge3c)
writer.close()
あなたは 'sess.run'を繰り返し使う必要はありませんが、実際にはすべてのイベントをイベントファイルに非同期で保存しています。 'sess.run'をすべて削除してもグラフは表示されます。 –
ありがとう!あなたが正しいです。 – Daniel