根据这篇论文,输出形状为
N + H - 1
,其中N
是输入的高度或宽度,H
是卷积核的高度或宽度。这是卷积的明显反向过程。这个教程给出了一个计算卷积输出形状的公式:(W−F+2P)/S+1
,其中W
是输入尺寸,F
是滤波器大小,P
是填充大小,S
是步幅。但在Tensorflow中,有一些测试用例如下: strides = [1, 2, 2, 1]
# Input, output: [batch, height, width, depth]
x_shape = [2, 6, 4, 3]
y_shape = [2, 12, 8, 2]
# Filter: [kernel_height, kernel_width, output_depth, input_depth]
f_shape = [3, 3, 2, 3]
因此,根据公式 (W−F+2P)/S+1
我们使用 y_shape
、f_shape
和 x_shape
来计算填充大小 P
。从 (12 - 3 + 2P) / 2 + 1 = 6
可以得知 P = 0.5
,这不是一个整数。那么在Tensorflow中如何进行反卷积操作呢?