{ }
View source on GitHub |
Cropping layer for 2D input (e.g. picture).
Inherits From: Layer
, Operation
tf.keras.layers.Cropping2D(
cropping=((0, 0), (0, 0)), data_format=None, **kwargs
)
It crops along spatial dimensions, i.e. height and width.
Example:
input_shape = (2, 28, 28, 3)
x = np.arange(np.prod(input_shape)).reshape(input_shape)
y = keras.layers.Cropping2D(cropping=((2, 2), (4, 4)))(x)
y.shape
(2, 24, 20, 3)
Input shape | |
---|---|
4D tensor with shape:
|
Output shape | |
---|---|
4D tensor with shape:
|
Methods
from_config
@classmethod
from_config( config )
Creates a layer from its config.
This method is the reverse of get_config
,
capable of instantiating the same layer from the config
dictionary. It does not handle layer connectivity
(handled by Network), nor weights (handled by set_weights
).
Args | |
---|---|
config
|
A Python dictionary, typically the output of get_config. |
Returns | |
---|---|
A layer instance. |
symbolic_call
symbolic_call(
*args, **kwargs
)