Reshape classkeras.layers.Reshape(target_shape, **kwargs)
Layer that reshapes inputs into the given shape.
Arguments
target_shape
can be -1 in which case the missing value is inferred from the
size of the array and remaining dimensions.Input shape
Arbitrary, but required to be compatible with target_shape.
Output shape
(batch_size, *target_shape)
Example
>>> x = keras.Input(shape=(12,))
>>> y = keras.layers.Reshape((3, 4))(x)
>>> y.shape
(None, 3, 4)
>>> # another example with shape inference using `-1` as dimension
>>> y = keras.layers.Reshape((-1, 2, 2))(x)
>>> y.shape
(None, 3, 2, 2)