remove conv2d() layers
This commit is contained in:
parent
f6d1348596
commit
984949ed16
@ -373,24 +373,21 @@ class MaxPooling2D(Pooling2D):
|
|||||||
|
|
||||||
Usage Example:
|
Usage Example:
|
||||||
|
|
||||||
>>> input_image = tf.constant([[[[1.], [1.], [2.], [4.], [2.], [4.], [2.]],
|
>>> input_image = tf.constant([[[[1.], [1.], [2.], [4.]],
|
||||||
... [[2.], [2.], [3.], [2.], [2.], [1.], [2.]],
|
... [[2.], [2.], [3.], [2.]],
|
||||||
... [[4.], [1.], [1.], [1.], [1.], [2.], [2.]],
|
... [[4.], [1.], [1.], [1.]],
|
||||||
... [[2.], [2.], [1.], [4.], [2.], [3.], [4.]],
|
... [[2.], [2.], [1.], [4.]]]])
|
||||||
... [[1.], [4.], [1.], [1.], [2.], [3.], [2.]],
|
|
||||||
... [[1.], [4.], [2.], [3.], [1.], [2.], [3.]],
|
|
||||||
... [[3.], [4.], [1.], [2.], [3.], [1.], [4.]]]])
|
|
||||||
>>> output = tf.constant([[[[1], [0]],
|
>>> output = tf.constant([[[[1], [0]],
|
||||||
... [[0], [1]]]])
|
... [[0], [1]]]])
|
||||||
>>> model = tf.keras.models.Sequential()
|
>>> model = tf.keras.models.Sequential()
|
||||||
>>> model.add(tf.keras.layers.Conv2D(1, kernel_size=(3, 3),
|
>>> model.add(tf.keras.layers.MaxPooling2D(pool_size=(2, 2),
|
||||||
... input_shape=(7,7,1)))
|
... input_shape=(4,4,1)))
|
||||||
>>> model.add(tf.keras.layers.MaxPooling2D(pool_size=(2, 2)))
|
|
||||||
>>> model.compile('adam', 'mean_squared_error')
|
>>> model.compile('adam', 'mean_squared_error')
|
||||||
>>> model.fit(input_image, output, steps_per_epoch=1,
|
>>> model.predict(input_image, steps=1)
|
||||||
... shuffle=False, verbose=0)
|
array([[[[2.],
|
||||||
>>> model.predict(input_image, steps=1).shape
|
[4.]],
|
||||||
(1, 2, 2, 1)
|
[[4.],
|
||||||
|
[4.]]]], dtype=float32)
|
||||||
|
|
||||||
For example, for stride=(1,1) and padding="same":
|
For example, for stride=(1,1) and padding="same":
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user