Description
the padding value of IPoolingLayer is different form MaxPooling2D in tensorflow
TensorRT:
Padding value depends on pooling type, -inf is used for max pooling and zero padding for average pooling
But in Tensorflow.keras:
Padding value is the nearest neighbor
Example
import tensorflow.keras.backend as K
from tensorflow.keras.layers import MaxPooling2D
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
config.gpu_options.per_process_gpu_memory_fraction = 0.95
tf.keras.backend.set_session(tf.Session(config=config))
data = np.array([[[[1], [2], [3]], [[4], [5], [6]], [[7], [8], [9]]]])
x = K.variable(value = data)
x = MaxPooling2D((3, 3), strides = 1, padding = 'same')(x)
print(x.shape) # (1, 3, 3, 1)
print(K.eval(x)) # [[[[5.][6.][6.]][[8.][9.][9.]][[8.][9.][9.]]]]