Skip to content

Commit 44e814d

Browse files
PR #17966: [keras/layers/pooling] Standardise docstring usage of "Default to"
Imported from GitHub PR #17966 This is one of many PRs. Discussion + request to split into multiple PRs @ #17748 Copybara import of the project: -- 60043ea by Samuel Marks <[email protected]>: [keras/layers/pooling/average_pooling2d.py,keras/layers/pooling/average_pooling3d.py,keras/layers/pooling/global_average_pooling2d.py,keras/layers/pooling/global_average_pooling3d.py,keras/layers/pooling/global_max_pooling2d.py,keras/layers/pooling/global_max_pooling3d.py,keras/layers/pooling/max_pooling2d.py,keras/layers/pooling/max_pooling3d.py] Standardise docstring usage of "Default to" Merging this change closes #17966 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17966 from SamuelMarks:keras.layers.pooling-defaults-to 60043ea PiperOrigin-RevId: 526664691
1 parent d72829a commit 44e814d

8 files changed

+31
-24
lines changed

keras/layers/pooling/average_pooling2d.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ class AveragePooling2D(Pooling2D):
108108
`(batch, height, width, channels)` while `channels_first`
109109
corresponds to inputs with shape
110110
`(batch, channels, height, width)`.
111-
It defaults to the `image_data_format` value found in your
112-
Keras config file at `~/.keras/keras.json`.
113-
If you never set it, then it will be "channels_last".
111+
When unspecified, uses
112+
`image_data_format` value found in your Keras config file at
113+
`~/.keras/keras.json` (if exists) else 'channels_last'.
114+
Defaults to 'channels_last'.
114115
115116
Input shape:
116117
- If `data_format='channels_last'`:

keras/layers/pooling/average_pooling3d.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ class AveragePooling3D(Pooling3D):
4848
`(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
4949
while `channels_first` corresponds to inputs with shape
5050
`(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
51-
It defaults to the `image_data_format` value found in your
52-
Keras config file at `~/.keras/keras.json`.
53-
If you never set it, then it will be "channels_last".
51+
When unspecified, uses
52+
`image_data_format` value found in your Keras config file at
53+
`~/.keras/keras.json` (if exists) else 'channels_last'.
54+
Defaults to 'channels_last'.
5455
5556
Input shape:
5657
- If `data_format='channels_last'`:

keras/layers/pooling/global_average_pooling2d.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ class GlobalAveragePooling2D(GlobalPooling2D):
4444
`(batch, height, width, channels)` while `channels_first`
4545
corresponds to inputs with shape
4646
`(batch, channels, height, width)`.
47-
It defaults to the `image_data_format` value found in your
48-
Keras config file at `~/.keras/keras.json`.
49-
If you never set it, then it will be "channels_last".
47+
When unspecified, uses `image_data_format` value found
48+
in your Keras config file at `~/.keras/keras.json`
49+
(if exists) else 'channels_last'. Defaults to 'channels_last'.
5050
keepdims: A boolean, whether to keep the spatial dimensions or not.
5151
If `keepdims` is `False` (default), the rank of the tensor is reduced
5252
for spatial dimensions.

keras/layers/pooling/global_average_pooling3d.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ class GlobalAveragePooling3D(GlobalPooling3D):
3636
`(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
3737
while `channels_first` corresponds to inputs with shape
3838
`(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
39-
It defaults to the `image_data_format` value found in your
40-
Keras config file at `~/.keras/keras.json`.
41-
If you never set it, then it will be "channels_last".
39+
When unspecified, uses
40+
`image_data_format` value found in your Keras config file at
41+
`~/.keras/keras.json` (if exists) else 'channels_last'.
42+
Defaults to 'channels_last'.
4243
keepdims: A boolean, whether to keep the spatial dimensions or not.
4344
If `keepdims` is `False` (default), the rank of the tensor is reduced
4445
for spatial dimensions.

keras/layers/pooling/global_max_pooling2d.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ class GlobalMaxPooling2D(GlobalPooling2D):
4242
`(batch, height, width, channels)` while `channels_first`
4343
corresponds to inputs with shape
4444
`(batch, channels, height, width)`.
45-
It defaults to the `image_data_format` value found in your
46-
Keras config file at `~/.keras/keras.json`.
47-
If you never set it, then it will be "channels_last".
45+
When unspecified, uses
46+
`image_data_format` value found in your Keras config file at
47+
`~/.keras/keras.json` (if exists) else 'channels_last'.
48+
Defaults to 'channels_last'.
4849
keepdims: A boolean, whether to keep the spatial dimensions or not.
4950
If `keepdims` is `False` (default), the rank of the tensor is reduced
5051
for spatial dimensions.

keras/layers/pooling/global_max_pooling3d.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ class GlobalMaxPooling3D(GlobalPooling3D):
3434
`(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
3535
while `channels_first` corresponds to inputs with shape
3636
`(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
37-
It defaults to the `image_data_format` value found in your
38-
Keras config file at `~/.keras/keras.json`.
39-
If you never set it, then it will be "channels_last".
37+
When unspecified, uses
38+
`image_data_format` value found in your Keras config file at
39+
`~/.keras/keras.json` (if exists) else 'channels_last'.
40+
Defaults to 'channels_last'.
4041
keepdims: A boolean, whether to keep the spatial dimensions or not.
4142
If `keepdims` is `False` (default), the rank of the tensor is reduced
4243
for spatial dimensions.

keras/layers/pooling/max_pooling2d.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ class MaxPooling2D(Pooling2D):
127127
`(batch, height, width, channels)` while `channels_first`
128128
corresponds to inputs with shape
129129
`(batch, channels, height, width)`.
130-
It defaults to the `image_data_format` value found in your
131-
Keras config file at `~/.keras/keras.json`.
132-
If you never set it, then it will be "channels_last".
130+
When unspecified, uses
131+
`image_data_format` value found in your Keras config file at
132+
`~/.keras/keras.json` (if exists) else 'channels_last'.
133+
Defaults to 'channels_last'.
133134
134135
Input shape:
135136
- If `data_format='channels_last'`:

keras/layers/pooling/max_pooling3d.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ class MaxPooling3D(Pooling3D):
4848
`(batch, spatial_dim1, spatial_dim2, spatial_dim3, channels)`
4949
while `channels_first` corresponds to inputs with shape
5050
`(batch, channels, spatial_dim1, spatial_dim2, spatial_dim3)`.
51-
It defaults to the `image_data_format` value found in your
52-
Keras config file at `~/.keras/keras.json`.
53-
If you never set it, then it will be "channels_last".
51+
When unspecified, uses
52+
`image_data_format` value found in your Keras config file at
53+
`~/.keras/keras.json` (if exists) else 'channels_last'.
54+
Defaults to 'channels_last'.
5455
5556
Input shape:
5657
- If `data_format='channels_last'`:

0 commit comments

Comments
 (0)