我读了 tensorflow 的 tf.nn.max_pool 中的“SAME”和“VALID”填充有什么区别?但这不适用于我的实验。
import tensorflow as tf
inputs = tf.random_normal([1, 64, 64, 3])
print(inputs.shape)
conv = tf.keras.layers.Conv2D(6, 4, strides=2, padding='same')
outputs = conv(inputs)
print(outputs.shape)
生产
(1, 64, 64, 3)
(1, 32, 32, 6)
. 但是,按照上面的链接会产生(1, 31, 31, 6)
,因为在没有任何填充的过滤器范围之外没有额外的值。
padding='same' 和 strides > 1 的 tf.keras.layers.Conv2D 表现如何?
我想知道确切的答案及其证据。