Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 51 additions & 49 deletions keras/layers/pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ class MaxPooling1D(_Pooling1D):
If None, it will default to `pool_size`.
padding: One of `"valid"` or `"same"` (case-insensitive).
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`(batch, steps, features)` while `channels_first`
`"channels_last"` corresponds to inputs with shape
`(batch, steps, features)` while `"channels_first"`
corresponds to inputs with shape
`(batch, features, steps)`.

Expand Down Expand Up @@ -124,10 +124,10 @@ class AveragePooling1D(_Pooling1D):
If None, it will default to `pool_size`.
padding: One of `"valid"` or `"same"` (case-insensitive).
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`(batch, steps, features)` while `channels_first`
`"channels_last"` corresponds to inputs with shape
`(batch, steps, features)` while `"channels_first"`
corresponds to inputs with shape
`(batch, features, steps)`.

Expand Down Expand Up @@ -228,15 +228,15 @@ class MaxPooling2D(_Pooling2D):
If None, it will default to `pool_size`.
padding: One of `"valid"` or `"same"` (case-insensitive).
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`(batch, height, width, channels)` while `channels_first`
`"channels_last"` corresponds to inputs with shape
`(batch, height, width, channels)` while `"channels_first"`
corresponds to inputs with shape
`(batch, channels, height, width)`.
It defaults to the `image_data_format` value found in your
Keras config file at `~/.keras/keras.json`.
If you never set it, then it will be "channels_last".
If you never set it, then it will be `"channels_last"`.

# Input shape
- If `data_format='channels_last'`:
Expand Down Expand Up @@ -273,7 +273,7 @@ class AveragePooling2D(_Pooling2D):
"""Average pooling operation for spatial data.

# Arguments
pool_size: integer or tuple of 2 integers,
pool_size: Integer or tuple of 2 integers,
factors by which to downscale (vertical, horizontal).
(2, 2) will halve the input in both spatial dimension.
If only one integer is specified, the same window length
Expand All @@ -283,15 +283,15 @@ class AveragePooling2D(_Pooling2D):
If None, it will default to `pool_size`.
padding: One of `"valid"` or `"same"` (case-insensitive).
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`(batch, height, width, channels)` while `channels_first`
`"channels_last"` corresponds to inputs with shape
`(batch, height, width, channels)` while `"channels_first"`
corresponds to inputs with shape
`(batch, channels, height, width)`.
It defaults to the `image_data_format` value found in your
Keras config file at `~/.keras/keras.json`.
If you never set it, then it will be "channels_last".
If you never set it, then it will be `"channels_last"`.

# Input shape
- If `data_format='channels_last'`:
Expand Down Expand Up @@ -387,21 +387,22 @@ class MaxPooling3D(_Pooling3D):
"""Max pooling operation for 3D data (spatial or spatio-temporal).

# Arguments
pool_size: tuple of 3 integers,
pool_size: Integer or tuple of 3 integers,
factors by which to downscale (dim1, dim2, dim3).
(2, 2, 2) will halve the size of the 3D input in each dimension.
strides: tuple of 3 integers, or None. Strides values.
strides: Integer, tuple of 3 integers, or None. Strides values.
If None, it will default to `pool_size`.
padding: One of `"valid"` or `"same"` (case-insensitive).
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`"channels_last"` corresponds to inputs with shape
`(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
while `channels_first` corresponds to inputs with shape
while `"channels_first"` corresponds to inputs with shape
`(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
It defaults to the `image_data_format` value found in your
Keras config file at `~/.keras/keras.json`.
If you never set it, then it will be "channels_last".
If you never set it, then it will be `"channels_last"`.

# Input shape
- If `data_format='channels_last'`:
Expand Down Expand Up @@ -437,21 +438,22 @@ class AveragePooling3D(_Pooling3D):
"""Average pooling operation for 3D data (spatial or spatio-temporal).

# Arguments
pool_size: tuple of 3 integers,
pool_size: Integer or tuple of 3 integers,
factors by which to downscale (dim1, dim2, dim3).
(2, 2, 2) will halve the size of the 3D input in each dimension.
strides: tuple of 3 integers, or None. Strides values.
strides: Integer, tuple of 3 integers, or None. Strides values.
If None, it will default to `pool_size`.
padding: One of `"valid"` or `"same"` (case-insensitive).
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`"channels_last"` corresponds to inputs with shape
`(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
while `channels_first` corresponds to inputs with shape
while `"channels_first"` corresponds to inputs with shape
`(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
It defaults to the `image_data_format` value found in your
Keras config file at `~/.keras/keras.json`.
If you never set it, then it will be "channels_last".
If you never set it, then it will be `"channels_last"`.

# Input shape
- If `data_format='channels_last'`:
Expand Down Expand Up @@ -513,10 +515,10 @@ class GlobalAveragePooling1D(_GlobalPooling1D):

# Arguments
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`(batch, steps, features)` while `channels_first`
`"channels_last"` corresponds to inputs with shape
`(batch, steps, features)` while `"channels_first"`
corresponds to inputs with shape
`(batch, features, steps)`.

Expand Down Expand Up @@ -559,10 +561,10 @@ class GlobalMaxPooling1D(_GlobalPooling1D):

# Arguments
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`(batch, steps, features)` while `channels_first`
`"channels_last"` corresponds to inputs with shape
`(batch, steps, features)` while `"channels_first"`
corresponds to inputs with shape
`(batch, features, steps)`.

Expand Down Expand Up @@ -614,15 +616,15 @@ class GlobalAveragePooling2D(_GlobalPooling2D):

# Arguments
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`(batch, height, width, channels)` while `channels_first`
`"channels_last"` corresponds to inputs with shape
`(batch, height, width, channels)` while `"channels_first"`
corresponds to inputs with shape
`(batch, channels, height, width)`.
It defaults to the `image_data_format` value found in your
Keras config file at `~/.keras/keras.json`.
If you never set it, then it will be "channels_last".
If you never set it, then it will be `"channels_last"`.

# Input shape
- If `data_format='channels_last'`:
Expand All @@ -649,15 +651,15 @@ class GlobalMaxPooling2D(_GlobalPooling2D):

# Arguments
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`(batch, height, width, channels)` while `channels_first`
`"channels_last"` corresponds to inputs with shape
`(batch, height, width, channels)` while `"channels_first"`
corresponds to inputs with shape
`(batch, channels, height, width)`.
It defaults to the `image_data_format` value found in your
Keras config file at `~/.keras/keras.json`.
If you never set it, then it will be "channels_last".
If you never set it, then it will be `"channels_last"`.

# Input shape
- If `data_format='channels_last'`:
Expand Down Expand Up @@ -709,15 +711,15 @@ class GlobalAveragePooling3D(_GlobalPooling3D):

# Arguments
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`"channels_last"` corresponds to inputs with shape
`(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
while `channels_first` corresponds to inputs with shape
while `"channels_first"` corresponds to inputs with shape
`(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
It defaults to the `image_data_format` value found in your
Keras config file at `~/.keras/keras.json`.
If you never set it, then it will be "channels_last".
If you never set it, then it will be `"channels_last"`.

# Input shape
- If `data_format='channels_last'`:
Expand All @@ -744,15 +746,15 @@ class GlobalMaxPooling3D(_GlobalPooling3D):

# Arguments
data_format: A string,
one of `channels_last` (default) or `channels_first`.
one of `"channels_last"` (default) or `"channels_first"`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`"channels_last"` corresponds to inputs with shape
`(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
while `channels_first` corresponds to inputs with shape
while `"channels_first"` corresponds to inputs with shape
`(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
It defaults to the `image_data_format` value found in your
Keras config file at `~/.keras/keras.json`.
If you never set it, then it will be "channels_last".
If you never set it, then it will be `"channels_last"`.

# Input shape
- If `data_format='channels_last'`:
Expand Down