Pooling Layers - Javatpoint 26/05/2022, 05:18
Home Java Keras JavaScript Bootstrap C HTML XHTML CSS jQuery XML
Pooling Layers
MaxPooling1D
1. keras.layers.MaxPooling1D(pool_size=2, strides=None, padding='valid', data_format='channels_last'
This layer performs max pooling operations for the temporal
data.
Arguments
pool_size: It refers to an integer that represents the
max pooling window's size.
strides: It can be an integer or None that represents
the factor through which it will downscale. For
example., 2 will halve the input. If it is set to None,
then it means it will default to the pool_size.
padding: It is case-sensitive, which is one of "valid"
or "same".
data_format: It can be a string of either
"channels_last" or "channels_first", which
represents the order of input dimensions. Here the
"channels_last" is the default format for temporal
data in Keras, which links to the input shape (batch,
steps, features). However, the "channels_first" is
used to relate the input shape (batch, features,
https://www.javatpoint.com/pooling-layers Page 1 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
steps).
Input shape
If the data_format is "channels_first", then the input
shape of a 3D tensor is (batch_size, features, steps), else
if data_format is "channels_last," the input shape of a 3D
tensor is (batch_size, steps, features).
Output shape
If the data_format is "channels_first", the output shape of
a 3D tensor will be (batch_size, features,
downsampled_steps), else if the data_format is
"channels_last" the output shape of a 3D tensor will be
(batch_size, downsampled_steps, features).
MaxPooling2D
1. keras.layers.MaxPooling2D(pool_size=
(2, 2), strides=None, padding='valid', data_format=None)
https://www.javatpoint.com/pooling-layers Page 2 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
The max pooling two-dimensional layer executes the max
pooling operations for spatial data.
Arguments
pool_size: It refers to an integer or tuple of 2
integers, factors through which it will downscale
(vertical, horizontal), such that (2, 2) will halve the
input in both spatial dimensions. If we specify only
one integer, then the similar length of the window will
be utilized for each dimension.
strides: The stride value can be an integer, tuple of 2
integers, or None. If None is selected, then it will
default to the pool_size.
padding: It is case-sensitive, which is one of "valid"
or "same".
data_format: It can be a string of either
"channels_last" or "channels_first", which is the
order of input dimensions. The "channels_last"
corresponds to the input shape (batch, height,
width, channels), whereas the "channels_first"
relates to the input shape (batch, channels, height,
width). It defaults to the image_data_format value
that resides in Keras config at ~/.keras/keras.json. If
you cannot find it in that folder, then it will be found in
the "channels_last".
Input shape
If the data_format is "channels_first", then the input
shape of a 4D tensor is (batch_size, channels, rows,
cols), else if data_format is "channels_last" the input
shape of a 4D tensor is (batch_size, rows, cols,
channels).
https://www.javatpoint.com/pooling-layers Page 3 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
Output shape
If the data_format is "channels_first", the output shape of
a 4D tensor will be (batch_size, channels, pooled_rows,
pooled_cols), else if the data_format is "channels_last"
the output shape of 4D tensor will be (batch_size,
pooled_rows, pooled_cols, channels).
MaxPooling3D
1. keras.layers.MaxPooling3D(pool_size=
(2, 2, 2), strides=None, padding='valid', data_format=None)
The max pooling three-dimensional layer executes the max
pooling operation for the data such as spatial or Spatio-
temporal, which is in the 3D.
Arguments
pool_size: It refers to a tuple of 3 integers, factors
through which it will downscale (dim1, dim2, dim3),
such that (2, 2, 2) will halve the size of a 3D input in
every dimension.
strides: The stride value can be a tuple of 3 integers
https://www.javatpoint.com/pooling-layers Page 4 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
or None.
padding: It is case-sensitive, which is one of "valid"
or "same".
data_format: It can be a string of either
"channels_last" or "channels_first", which is the order
of input dimensions. Here the "channels_last"
relates to the input shape (batch, spatial_dim1,
spatial_dim2, spatial_dim3, channels) and the
"channels_first" relates to the input shape (batch,
channels, spatial_dim1, spatial_dim2,
spatial_dim3). It defaults to the image_data_format
value that resides in Keras config at
~/.keras/keras.json. If you cannot find it in that
folder, then it will be found in the "channels_last".
Input shape
If the data_format is "channels_first", then the input
shape of 5D tensor is (batch_size, channels, spatial_dim1,
spatial_dim2, spatial_dim3), else if data_format is
"channels_last" the input shape of 5D tensor is
(batch_size, spatial_dim1, spatial_dim2, spatial_dim3,
channels).
Output shape
If the data_format is "channels_first", the output shape of
a 5D tensor will be (batch_size, channels, pooled_dim1,
pooled_dim2, pooled_dim3), else if the data_format is
"channels_last" the output shape of a 5D tensor will be
(batch_size, pooled_dim1, pooled_dim2, pooled_dim3,
channels).
https://www.javatpoint.com/pooling-layers Page 5 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
AveragePooling1D
1. keras.layers.AveragePooling1D(pool_size=2, strides=None, padding='valid', data_format='channels_las
This layer performs average pooling for temporal data.
Arguments
pool_size: It refers to an integer that depicts the max
pooling window's size.
strides: It can be an integer or None that represents
the factor through which it will downscale. For
example, 2 will halve the input. If None is selected,
then it will default to the pool_size.
padding: It is case-sensitive, which is one of "valid"
or "same".
data_format: It can be a string of either
"channels_last" or "channels_first", which is the
order of input dimensions. Here the "channels_last"
relates to the input shape (batch, steps, features),
which is the default format for temporal data in Keras.
However, the "channels_first" is used to relate the
input shape (batch, features, steps).
Input shape
https://www.javatpoint.com/pooling-layers Page 6 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
If the data_format is "channels_first", then the input
shape of a 3D tensor is (batch_size, features, steps), else
if data_format is "channels_last," the input shape of a 3D
tensor is (batch_size, steps, features).
Output shape
If the data_format is "channels_first", the output shape of
a 3D tensor will be (batch_size, features,
downsampled_steps), else if the data_format is
"channels_last" the output shape of a 3D tensor will be
(batch_size, downsampled_steps, features).
AveragePooling2D
1. keras.layers.AveragePooling2D(pool_size=
(2, 2), strides=None, padding='valid', data_format=None)
It performs average pooling for spatial data.
Arguments
pool_size: It refers to an integer or tuple of 2
integers, factors through which it will downscale
(vertical, horizontal), such that (2, 2) will halve the
input in both spatial dimensions. If we specify only
one integer, then the similar length of the window will
be used for both dimensions.
strides: The stride value can be an integer, tuple of 2
integers, or None. If None is selected, then it will
default to the pool_size.
https://www.javatpoint.com/pooling-layers Page 7 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
padding: It is case-sensitive, which is one of "valid"
or "same".
data_format: It can be a string of either
"channels_last" or "channels_first", which is the order
of input dimensions. Here the "channels_last"
relates to the input shape (batch, height, width,
channels), and the "channels_first" relates to the
input shape (batch, channels, height, width). It
defaults to the image_data_format value that is
found in Keras config at ~/.keras/keras.json. If you
cannot find it in that folder, then it is residing at
"channels_last".
Input shape
If the data_format is "channels_first", then the input
shape of a 4D tensor is (batch_size, channels, rows,
cols), else if data_format is "channels_last" the input
shape of a 4D tensor is (batch_size, rows, cols,
channels).
Output shape
If the data_format is "channels_first", the output shape of
a 4D tensor will be (batch_size, channels, pooled_rows,
pooled_cols), else if the data_format is "channels_last"
the output shape of 4D tensor will be (batch_size,
pooled_rows, pooled_cols, channels).
https://www.javatpoint.com/pooling-layers Page 8 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
AveragePooling3D
1. keras.layers.AveragePooling3D(pool_size=
(2, 2, 2), strides=None, padding='valid', data_format=None)
It performs average pooling operation for 3D data such as
Spatio-temporal or spatial.
Arguments
pool_size: It refers to a tuple of 3 integers, factors
through which it will downscale (dim1, dim2, dim3),
such that (2, 2, 2) will halve the size of a 3D input in
every dimension.
strides: The stride value can be a tuple of 3 integers
or None.
padding: It is case-sensitive, which is one of "valid"
or "same".
data_format: It can be a string of either
"channels_last" or "channels_first", which is the order
of input dimensions. Here the "channels_last"
relates to the input shape (batch, spatial_dim1,
spatial_dim2, spatial_dim3, channels) and the
"channels_first" relates to the input shape (batch,
channels, spatial_dim1, spatial_dim2,
spatial_dim3). It defaults to the image_data_format
value that is found in Keras config at
~/.keras/keras.json. If you cannot find it in that
folder, then it is residing at "channels_last".
https://www.javatpoint.com/pooling-layers Page 9 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
Input shape
If the data_format is "channels_first", then the input
shape of 5D tensor is (batch_size, channels, spatial_dim1,
spatial_dim2, spatial_dim3), else if data_format is
"channels_last" the input shape of 5D tensor is
(batch_size, spatial_dim1, spatial_dim2, spatial_dim3,
channels).
Output shape
If the data_format is "channels_first", the output shape of
a 5D tensor will be (batch_size, channels, pooled_dim1,
pooled_dim2, pooled_dim3), else if the data_format is
"channels_last" the output shape of a 5D tensor will be
(batch_size, pooled_dim1, pooled_dim2, pooled_dim3,
channels).
GlobalMaxPooling1D
1. keras.layers.GlobalMaxPooling1D(data_format='channels_last')
It performs global max pooling operations for temporal data.
Arguments
data_format: It can be a string of either
"channels_last" or "channels_first", which is the
order of input dimensions. Here the "channels_last"
relates to the input shape (batch, steps, features),
which is the default format for temporal data in Keras.
However, the "channels_first" is used to relate the
input shape (batch, features, steps). It defaults to
the image_data_format value that is found in Keras
config at ~/.keras/keras.json. If you cannot find it in
https://www.javatpoint.com/pooling-layers Page 10 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
that folder, then it is residing at "channels_last".
Input shape
If the data_format is "channels_first", then the input
shape of a 3D tensor is (batch_size, features, steps), else
if data_format is "channels_last," the input shape of a 3D
tensor is (batch_size, steps, features).
Output shape
It is a 2D tensor with shape (batch_size, features).
GlobalAveragePooling1D
1. keras.layers.GlobalAveragePooling1D(data_format='channels_last')
It performs global average pooling operations for temporal
data.
Arguments
data_format: It can be a string of either
"channels_last" or "channels_first", which is the
order of input dimensions. Here the "channels_last"
relates to the input shape (batch, steps, features),
which is the default format for temporal data in Keras.
However, the "channels_first" is used to relate the
input shape (batch, features, steps).
Input shape
If the data_format is "channels_first", then the input
shape of a 3D tensor is (batch_size, features, steps), else
if data_format is "channels_last," the input shape of a 3D
tensor is (batch_size, steps, features).
https://www.javatpoint.com/pooling-layers Page 11 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
Output shape
It is a 2D tensor with shape (batch_size, features).
GlobalMaxPooling2D
1. keras.layers.GlobalMaxPooling2D(data_format=None)
It performs global max pooling operations for spatial data.
Arguments
data_format: It can be a string of either
"channels_last" or "channels_first", which is the
order of input dimensions. Here the "channels_last"
relates to the input shape (batch, height, width,
channels), and "channels_first" is used to relate the
input shape (batch, channels, height, width). It
defaults to the image_data_format value that is
found in Keras config at ~/.keras/keras.json. If you
cannot find it in that folder, then it is residing at
"channels_last".
Input shape
If the data_format is "channels_first", then the input
shape of a 4D tensor is (batch_size, channels, rows,
cols), else if data_format is "channels_last" the input
shape of a 4D tensor is (batch_size, rows, cols,
channels).
Output shape
It is a 2D tensor with shape (batch_size, features).
GlobalAveragePooling2D
https://www.javatpoint.com/pooling-layers Page 12 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
1. keras.layers.GlobalAveragePooling2D(data_format=None)
It performs global average pooling operations for spatial
data.
Arguments
data_format: It can be a string of either
"channels_last" or "channels_first", which is the
order of input dimensions. Here the "channels_last"
relates to the input shape (batch, height, width,
channels), and "channels_first" is used to relate the
input shape (batch, channels, height, width). It
defaults to the image_data_format value that is
found in Keras config at ~/.keras/keras.json. If you
cannot find it in that folder, then it is residing at
"channels_last".
Input shape
If the data_format is "channels_first", then the input
shape of a 4D tensor is (batch_size, channels, rows,
cols), else if data_format is "channels_last" the input
https://www.javatpoint.com/pooling-layers Page 13 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
shape of a 4D tensor is (batch_size, rows, cols,
channels).
Output shape
It is a 2D tensor with shape (batch_size, features).
GlobalMaxPooling3D
1. keras.layers.GlobalMaxPooling3D(data_format=None)
It performs global max pooling operation for three-
dimensional data.
Arguments
data_format: It can be a string of either
"channels_last" or "channels_first", which is the
order of input dimensions. Here the "channels_last"
relates to the input shape (batch, spatial_dim1,
spatial_dim2, spatial_dim3, channels), and
"channels_first" is used to relate the input shape
(batch, channels, spatial_dim1, spatial_dim2,
spatial_dim3). It defaults to the image_data_format
value that is found in Keras config at
~/.keras/keras.json. If you cannot find it in that
folder, then it is residing at "channels_last".
Input shape
If the data_format is "channels_first", then the input
shape of 5D tensor is (batch_size, channels, spatial_dim1,
spatial_dim2, spatial_dim3), else if data_format is
"channels_last" the input shape of 5D tensor is
(batch_size, spatial_dim1, spatial_dim2, spatial_dim3,
channels).
https://www.javatpoint.com/pooling-layers Page 14 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
Output shape
It is a 2D tensor with shape (batch_size, features).
GlobalAveragePooling3D
1. keras.layers.GlobalAveragePooling3D(data_format=None)
It performs operations of global average pooling for 3D
data.
Arguments
data_format: It can be a string of either
"channels_last" or "channels_first", which is the
order of input dimensions. Here the "channels_last"
relates to the input shape (batch, spatial_dim1,
spatial_dim2, spatial_dim3, channels), and
"channels_first" is used to relate the input shape
(batch, channels, spatial_dim1, spatial_dim2,
spatial_dim3). It defaults to the image_data_format
value that is found in Keras config at
~/.keras/keras.json. If you cannot find it in that
folder, then it is residing at "channels_last".
Input shape
If the data_format is "channels_first", then the input
shape of 5D tensor is (batch_size, channels, spatial_dim1,
spatial_dim2, spatial_dim3), else if data_format is
"channels_last" the input shape of 5D tensor is
(batch_size, spatial_dim1, spatial_dim2, spatial_dim3,
channels).
Output shape
https://www.javatpoint.com/pooling-layers Page 15 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
It is a 2D tensor with shape (batch_size, features).
← Prev Next →
For Videos Join Our Youtube Channel:
Join Now
Feedback
Send your Feedback to feedback@javatpoint.com
Help Others, Please Share
https://www.javatpoint.com/pooling-layers Page 16 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
Learn Latest Tutorials
Splunk SPSS
Swagger Transact-SQL
Tumblr ReactJS
Regex Reinforcement
Learning
R Programming RxJS
React Native Python Design
Patterns
https://www.javatpoint.com/pooling-layers Page 17 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
Python Pillow Python Turtle
Keras
Preparation
Aptitude Reasoning
Verbal Ability Interview
Questions
Company
Questions
Trending Technologies
https://www.javatpoint.com/pooling-layers Page 18 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
Artificial AWS
Intelligence
Selenium Cloud Computing
Hadoop ReactJS
Data Science Angular 7
Blockchain Git
Machine Learning DevOps
https://www.javatpoint.com/pooling-layers Page 19 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
B.Tech / MCA
DBMS Data Structures
DAA Operating System
Computer Network Compiler Design
Computer Discrete
Organization Mathematics
https://www.javatpoint.com/pooling-layers Page 20 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
Ethical Hacking Computer Graphics
Software Web Technology
Engineering
Cyber Security Automata
C Programming C++
Java .Net
Python Programs
Control System Data Mining
https://www.javatpoint.com/pooling-layers Page 21 of 22
Pooling Layers - Javatpoint 26/05/2022, 05:18
Data Warehouse
https://www.javatpoint.com/pooling-layers Page 22 of 22