import numpy as np
import tensorflow as tf
p = tf.placeholder(dtype=tf.float32, shape=[1])
y = p
with tf.Session() as sess:
d = np.random.rand(1)
print(sess.run(y, feed_dict={p: d}))
占位符
不必指定初始值,可在运行时,通过
Session.run,Tensor.eval()或者Operation.run()函数的feed_dict参数指定;