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

轉自點擊打開鏈接



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