View source on GitHub |
Max pooling operation for 3D data (spatial or spatio-temporal).
Inherits From: Layer
, Operation
tf.keras.layers.MaxPool3D(
pool_size=(2, 2, 2),
strides=None,
padding='valid',
data_format=None,
name=None,
**kwargs
)
Downsamples the input along its spatial dimensions (depth, height, and
width) by taking the maximum value over an input window (of size defined by
pool_size
) for each channel of the input. The window is shifted by
strides
along each dimension.
Input shape:
- If
data_format="channels_last"
: 5D tensor with shape:(batch_size, spatial_dim1, spatial_dim2, spatial_dim3, channels)
- If
data_format="channels_first"
: 5D tensor with shape:(batch_size, channels, spatial_dim1, spatial_dim2, spatial_dim3)
Output shape:
- If
data_format="channels_last"
: 5D tensor with shape:(batch_size, pooled_dim1, pooled_dim2, pooled_dim3, channels)
- If
data_format="channels_first"
: 5D tensor with shape:(batch_size, channels, pooled_dim1, pooled_dim2, pooled_dim3)
Example:
depth = 30
height = 30
width = 30
channels = 3
inputs = keras.layers.Input(shape=(depth, height, width, channels))
layer = keras.layers.MaxPooling3D(pool_size=3)
outputs = layer(inputs) # Shape: (batch_size, 10, 10, 10, 3)
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
)