gpt4 book ai didi

neural-network - 在tensorflow中使用tf.nn.conv2d_transpose获取反卷积层的输出形状

转载 作者:行者123 更新时间:2023-12-03 22:41:51 25 4
gpt4 key购买 nike

根据这个paper ,输出形状为 N + H - 1 , N是输入高度或宽度,H是内核高度或宽度。这是卷积的明显逆过程。此 tutorial给出计算卷积输出形状的公式为(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]

所以我们使用 y_shape , f_shapex_shape ,根据公式 (W−F+2P)/S+1计算填充大小 P .来自 (12 - 3 + 2P) / 2 + 1 = 6 ,我们得到 P = 0.5 , 不是整数。 Tensorflow 中的反卷积是如何工作的?

最佳答案

对于解卷积,

output_size = strides * (input_size-1) + kernel_size - 2*padding

strides, input_size, kernel_size, padding 都是整数
“有效”的填充为零

关于neural-network - 在tensorflow中使用tf.nn.conv2d_transpose获取反卷积层的输出形状,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35980044/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com