如何在 keras / tensorflow 中使用相同的平均池处理不均匀输入

How is uneven input handled with same average pooling in keras / tensorflow

与此非常相似 但用于平均池化。

accpeted answer 说,相同的池使用 -inf 作为最大池的填充。 但是用于平均池化的是什么。 他们只使用 0 吗?

好的,我自己测试一下。

np.set_printoptions(threshold=np.nan)
x = np.array([[[3.0,3.0,3.0],[3.0,3.0,3.0]]])
x = x.reshape(1,2,3,1)
sess = tf.Session()
K.set_session(sess)
b = K.constant(x)
b = AveragePooling2D(pool_size=(2, 2), padding="same")(b)
b = tf.Print(b,[b])
sess.run(b)

这个 returns 张量 [[[[3][3]]]] 所以它必须用 0 填充。