使用placeholder()类型时,说明你是想在结果运行时在给里面的变量赋值
使用placeholder()必须与feed_dict()绑定在一起
import tensorflow as tf
input1 = tf.placeholder(tf.float32)
input2 = tf.placeholder(tf.float32)
output = tf.multiply(input1,input2)
with tf.Session() as sess:
print(sess.run(output,feed_dict={input1:[7.],input2:[2.0]}))
Tensorflow中废弃的API及替代
tf.mul , tf.sub , tf.neg 已经废弃
分别可用tf.multiply , tf.subtract , tf.negative替代