module 'tensorflow' has no attribute 'types' ,module 'tensorflow' has no attribute 'mul'

代码:

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.]})

转自点击打开链接



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章