tensorflow fetch 取回某个值

为了取回操作的输出内容, 可以在使用 Session 对象的 run() 调用 执行图时,
传入一些 tensor, 这些 tensor 会帮助你取回结果. 在之前的例子里,
我们只取回了单个节点 state, 但是你也可以取回多个 tensor:

import tensorflow as tf
input1 = tf.constant(3.0)
input2 = tf.constant(2.0)
input3 = tf.constant(5.0)
intermed = tf.add(input2, input3)
mul = tf.multiply(input1, intermed)

with tf.Session() as sess:
 result = sess.run([mul, intermed])
 print (result)
posted @ 2018-10-01 10:46  luoganttcc  阅读(96)  评论(0编辑  收藏  举报