x = tf.placeholder(tf.float32,[None,784])是什么意思?

Rac*_*fer 20 tensorflow

我知道tf.placeholder的基本用法:

x = tf.placeholder(tf.float32, shape=(1024, 1024))
y = tf.matmul(x, x)

with tf.Session() as sess:
   print(sess.run(y))  # ERROR: will fail because x was not fed.

   rand_array = np.random.rand(1024, 1024)
   print(sess.run(y, feed_dict={x: rand_array}))  # Will succeed.
Run Code Online (Sandbox Code Playgroud)

我知道第二个参数是关于形状的.但是当形状中第一个是None时,我不知道这是什么意思.例如:[无,784].

nes*_*uno 37

从教程:Deep MNIST for Experts

这里我们为它分配一个[None,784]的形状,其中784是单个扁平28乘28像素MNIST图像的维度,None表示对应于批量大小的第一个维度可以是任何大小.