Python TypeError:无法将int32转换为张量或运算
我在python 3.6上运行以下操作:Python TypeError:无法将int32转换为张量或运算,python,tensorflow,Python,Tensorflow,我在python 3.6上运行以下操作: import tensorflow as tf x = 2 y = 3 add_op = tf.add(x, y) mul_op = tf.mul(x, y) useless = tf.mul(x, add_op) pow_op = tf.pow(add_op, mul_op) with tf.Session() as sess: z, not_useless = sess.run([op3, useless]) 得到了这个错误: T
import tensorflow as tf
x = 2
y = 3
add_op = tf.add(x, y)
mul_op = tf.mul(x, y)
useless = tf.mul(x, add_op)
pow_op = tf.pow(add_op, mul_op)
with tf.Session() as sess:
z, not_useless = sess.run([op3, useless])
得到了这个错误:
TypeError: Can not convert a int32 into a Tensor or Operation.
这是指某一行吗?它必须是关于最后一行的。代码来自下一张幻灯片的第41页确定找到了问题!:)使用tf.Session()作为sess:z,not_unavouse=sess.run([pow_op,unavouse])print(z)print(not_unavouse)好吧,那么我们用什么作为
op3
?作者在幻灯片中混淆了op3和pow_op