【发布时间】:2017-07-17 11:30:39
【问题描述】:
我是 TensorFlow 的新手。我有两个张量/张量流对象,X 和 Y,它们基本上是两个矩阵。我对它们进行了一些计算并想打印它们的值。
output = tf.reduce_sum(tf.log(tf.exp(tf.matmul(tf.transpose(X), Y))))
print(output.get_shape()) #Shows ()
我想获取output 的值。我无法打印它。
试过这样做:
init = tf.initialize_all_variables()
sess = tf.Session()
output = tf.reduce_sum(tf.log(tf.exp(tf.matmul(tf.transpose(X), Y))))
print(output.get_shape())
sess.run(init)
v = sess.run(output)
print(v)
但无济于事!抛出以下错误:
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'Placeholder' with dtype int32 and shape [100]
【问题讨论】:
-
我在 3 小时前解释了这个过程 here
标签: python tensorflow