6. TensorFlowの計算グラフ
● 計算グラフ
● 複数のノードからなるネットワーク。
● TensorFlowでは計算グラフを構築、コンパイル
して実行する。
6
g = tf.Graph()
with g.as_default():
a = tf.constant(1, name='a')
b = tf.constant(2, name='b')
c = tf.constant(3, name='c')
z = 2*(a-b) + c
with tf.Session(graph=g) as sess:
print('2*(a-b)+c => ', sess.run(z))