What is the meaning of the (None, 100) in Output Shape? Is this("None") the Sample number or the hidden dimension?
-
1It its the size of the data set. Set to `None`, as it is not bounded by a specific number – DJK Nov 11 '17 at 17:10
2 Answers
None
means this dimension is variable.
The first dimension in a keras model is always the batch size. You don't need fixed batch sizes, unless in very specific cases (for instance, when working with stateful=True
LSTM layers).
That's why this dimension is often ignored when you define your model. For instance, when you define input_shape=(100,200)
, actually you're ignoring the batch size and defining the shape of "each sample". Internally the shape will be (None, 100, 200)
, allowing a variable batch size, each sample in the batch having the shape (100,200)
.
The batch size will be then automatically defined in the fit
or predict
methods.
Other None
dimensions:
Not only the batch dimension can be None
, but many others as well.
For instance, in a 2D convolutional network, where the expected input is (batchSize, height, width, channels)
, you can have shapes like (None, None, None, 3)
, allowing variable image sizes.
In recurrent networks and in 1D convolutions, you can also make the length/timesteps
dimension variable, with shapes like (None, None, featuresOrChannels)

- 84,878
- 18
- 192
- 214
-
Thank you! If I have 3 input of which feature number is 4 and the batch number is 1 then after Dense layer(5) which has 5 neurons I got the one number from each 5 neurons. So I finally get (1,5) output dimension Is it right? – jung hyemin Nov 12 '17 at 06:32
-
1I don't understand "3 input of which feature number is 4". But a `Dense(5)` will always transform the last dimension in 5 and repeat the others. An input shape of `(batch, 4)` will restult in `(batch,5)`; and an input shape of `(batch, timesteps, 4)` will result in `(batch, timesteps, 5)`. – Daniel Möller Nov 12 '17 at 08:19
-
1
-
Convolutions are "sliding filters", they slide across the image's height and width. The size of the "filters" is constant. Each "step" in the sliding produces one output pixel. If you have less area to slide, you produce less output pixels, if you have more area to slide, you produce more output pixels. – Daniel Möller May 19 '20 at 04:36
Yes, None
in summary means a dynamic dimension of a batch (mini batch).
This is why you can set any batch size to your model.
The summary()
method is part of TF that incorporates Keras method print_summary()
.

- 42,291
- 14
- 186
- 151