tf.placeholder()输入变量
函数中使用tf.placeholder()时,在调用该函数(sess.run())要加入参数(feed_dict)
1 import tensorflow as tf 2 3 input1 = tf.placeholder(tf.float32) 4 input2 = tf.placeholder(tf.float32) 5 6 output = tf.multiply(input1,input2) 7 8 with tf.Session() as sess: 9 print(sess.run(output,feed_dict={input1:[7.],input2:[2.0]}))