python
placeholder的用法
import tensorflow as tf
import numpy as np
x = tf.placeholder(tf.float32, shape=(5, 5)) #形参
y = tf.matmul(x, x)
with tf.Session() as sess:
# print(sess.run(y)) # ERROR: 此处x还没赋值.
rand_array = np.random.rand(5, 5)
print(sess.run(y, feed_dict={x: rand_array})) # Will succeed.