代码:
input1 = tf.placeholder(tf.types.float32)
input2 = tf.placeholder(tf.types.float32)
output = tf.mul(input1, input2)
with tf.Session()as sess:
print (sess.run([output], feed_dict={input:[7.], input2:[2.]}))
报错1:
AttributeError: module 'tensorflow' has no attribute 'types'
解决办法:
input1 = tf.placeholder(tf.float32)
input2 = tf.placeholder(tf.float32)
报错2:
AttributeError: module 'tensorflow' has no attribute 'mul'
解决办法:
output = tf.multiply(input1, input2)
报错3:
Cannot interpret feed_dict key as Tensor: Can not convert a method into a Tensor.
解决办法:
print sess.run([output], feed_dict={input1:[7.], input2:[2.]})
转自点击打开链接