zl程序教程

您现在的位置是:首页 >  其它

当前栏目

tensorflow fetch 取回某个值

Tensorflow 某个 fetch
2023-09-14 09:15:50 时间

为了取回操作的输出内容, 可以在使用 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)