Tensorflow 官方文档 Feed章节有误

时间:2021-12-05 19:05:22

Tensorflow 官方文档 Feed章节有误

教程中

input1 = tf.placeholder(tf.types.float32)

运行时会报错:

 input1 = tf.placeholder(tf.types.float32)
AttributeError: 'module' object has no attribute 'types'

其中

tf.types.float32

要去掉types修改成

 input1 = tf.placeholder(tf.types.float32)

这样运行就不会报错了

import tensorflow as tf

input1 = tf.placeholder(tf.float32)
nput2 = tf.placeholder(tf.float32)
output = tf.mul(input1, input2)

with tf.Session() as sess:
print sess.run([output], feed_dict={input1:[7.], input2:[2.]})

运行结果:

[array([ 14.], dtype=float32)]