Flatten layer
- 원본 링크 : https://keras.io/api/layers/reshaping_layers/flatten/
- 최종 확인 : 2024-11-25
Flatten
class
keras.layers.Flatten(data_format=None, **kwargs)
Flattens the input. Does not affect the batch size.
Note: If inputs are shaped (batch,)
without a feature axis, then flattening adds an extra channel dimension and output shape is (batch, 1)
.
Arguments
- data_format: A string, one of
"channels_last"
(default) or"channels_first"
. The ordering of the dimensions in the inputs."channels_last"
corresponds to inputs with shape(batch, ..., channels)
while"channels_first"
corresponds to inputs with shape(batch, channels, ...)
. When unspecified, usesimage_data_format
value found in your Keras config file at~/.keras/keras.json
(if exists). Defaults to"channels_last"
.
Example
>>> x = keras.Input(shape=(10, 64))
>>> y = keras.layers.Flatten()(x)
>>> y.shape
(None, 640)