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