Tensorflow 2.0 Compatible Answer: Detailed Explanations have been provided above, about "Valid" and "Same" Padding.
However, I will specify different Pooling Functions and their respective Commands in Tensorflow 2.x (>= 2.0)
, for the benefit of the community.
Functions in 1.x:
tf.nn.max_pool
tf.keras.layers.MaxPool2D
Average Pooling => None in tf.nn, tf.keras.layers.AveragePooling2D
Functions in 2.x:
tf.nn.max_pool
if used in 2.x and tf.compat.v1.nn.max_pool_v2
or tf.compat.v2.nn.max_pool
, if migrated from 1.x to 2.x.
tf.keras.layers.MaxPool2D
if used in 2.x and
tf.compat.v1.keras.layers.MaxPool2D
or tf.compat.v1.keras.layers.MaxPooling2D
or tf.compat.v2.keras.layers.MaxPool2D
or tf.compat.v2.keras.layers.MaxPooling2D
, if migrated from 1.x to 2.x.
Average Pooling => tf.nn.avg_pool2d
or tf.keras.layers.AveragePooling2D
if used in TF 2.x and
tf.compat.v1.nn.avg_pool_v2
or tf.compat.v2.nn.avg_pool
or tf.compat.v1.keras.layers.AveragePooling2D
or tf.compat.v1.keras.layers.AvgPool2D
or tf.compat.v2.keras.layers.AveragePooling2D
or tf.compat.v2.keras.layers.AvgPool2D
, if migrated from 1.x to 2.x.
For more information about Migration from Tensorflow 1.x to 2.x, please refer to this Migration Guide.