JavaEar 专注于收集分享传播有价值的技术资料

# x = tf.placeholder（tf.float32，[None，784]）是什么意思？ (what does x = tf.placeholder(tf.float32, [None, 784]) means?)

I know basic use for 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.
``````

I know the second parameter is about shape. However I don't know what is that mean when the first one is None in the shape. ex:[None,784].

### 1个回答

最佳答案

1. #### 英文原文

From the tutorial: Deep MNIST for Experts

Here we assign it a shape of [None, 784], where 784 is the dimensionality of a single flattened 28 by 28 pixel MNIST image, and None indicates that the first dimension, corresponding to the batch size, can be of any size.

#### 中文翻译

从教程：专家深度MNIST

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

From the tutorial: Deep MNIST for Experts

Here we assign it a shape of [None, 784], where 784 is the dimensionality of a single flattened 28 by 28 pixel MNIST image, and None indicates that the first dimension, corresponding to the batch size, can be of any size.

从教程：专家深度MNIST

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