Merge pull request #35871 from Joseph-Rance:patch-3
PiperOrigin-RevId: 290844721 Change-Id: Ieda686900c4771fa90dd666c5a0b000e2415dedf
This commit is contained in:
commit
470239ee94
@ -370,6 +370,24 @@ class MaxPooling2D(Pooling2D):
|
||||
[[10.],
|
||||
[11.],
|
||||
[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":
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user