Merge pull request #35871 from Joseph-Rance:patch-3

PiperOrigin-RevId: 290844721
Change-Id: Ieda686900c4771fa90dd666c5a0b000e2415dedf
This commit is contained in:
TensorFlower Gardener 2020-01-21 16:11:12 -08:00
commit 470239ee94

View File

@ -370,6 +370,24 @@ class MaxPooling2D(Pooling2D):
[[10.], [[10.],
[11.], [11.],
[12.]]]], dtype=float32)> [12.]]]], dtype=float32)>
Usage Example:
>>> input_image = tf.constant([[[[1.], [1.], [2.], [4.]],
... [[2.], [2.], [3.], [2.]],
... [[4.], [1.], [1.], [1.]],
... [[2.], [2.], [1.], [4.]]]])
>>> output = tf.constant([[[[1], [0]],
... [[0], [1]]]])
>>> model = tf.keras.models.Sequential()
>>> model.add(tf.keras.layers.MaxPooling2D(pool_size=(2, 2),
... input_shape=(4,4,1)))
>>> model.compile('adam', 'mean_squared_error')
>>> model.predict(input_image, steps=1)
array([[[[2.],
[4.]],
[[4.],
[4.]]]], dtype=float32)
For example, for stride=(1,1) and padding="same": For example, for stride=(1,1) and padding="same":