Tensorflow conv2d_transpose 大小错误 "Number of rows of out_backprop doesn't match computed"
Tensorflow conv2d_transpose size error "Number of rows of out_backprop doesn't match computed"
我正在 tensorflow 中创建一个卷积自动编码器。我得到了这个确切的错误:
tensorflow.python.framework.errors.InvalidArgumentError: Conv2DBackpropInput: Number of rows of out_backprop doesn't match computed: actual = 8, computed = 12
[[Node: conv2d_transpose = Conv2DBackpropInput[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/cpu:0"](conv2d_transpose/output_shape, Variable_1/read, MaxPool_1)]]
相关代码:
l1d = tf.nn.relu(tf.nn.conv2d_transpose(l1da, w2, [10, 12, 12, 32], strides=[1, 1, 1, 1], padding='SAME'))
其中
w2 = tf.Variable(tf.random_normal([5, 5, 32, 64], stddev=0.01))
我检查了 conv2d_transpose 输入的形状,即 l1da,它是正确的 (10x8x8x64)。 batch size为10,这一层的输入是8x8x64的形式,输出应该是12x12x32.
我错过了什么?
发现错误。填充应该是 "Valid",而不是 "Same"。
我正在 tensorflow 中创建一个卷积自动编码器。我得到了这个确切的错误:
tensorflow.python.framework.errors.InvalidArgumentError: Conv2DBackpropInput: Number of rows of out_backprop doesn't match computed: actual = 8, computed = 12
[[Node: conv2d_transpose = Conv2DBackpropInput[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/cpu:0"](conv2d_transpose/output_shape, Variable_1/read, MaxPool_1)]]
相关代码:
l1d = tf.nn.relu(tf.nn.conv2d_transpose(l1da, w2, [10, 12, 12, 32], strides=[1, 1, 1, 1], padding='SAME'))
其中
w2 = tf.Variable(tf.random_normal([5, 5, 32, 64], stddev=0.01))
我检查了 conv2d_transpose 输入的形状,即 l1da,它是正确的 (10x8x8x64)。 batch size为10,这一层的输入是8x8x64的形式,输出应该是12x12x32.
我错过了什么?
发现错误。填充应该是 "Valid",而不是 "Same"。