ConvTranspose2D seems strange at output_padding=0

I created one ConvTranspose 2D layer in tf.keras.layers

input = tf.keras.layers.Input(shape=(7,7,1))
layer = tf.keras.layers.Conv2DTranspose(1,kernel_size=8, stride=3, padding=‘same’, output_padding=0, use_bias=False)

I fed input which is all zeros but for only one element with value one into the layer, changing the location of value one

I expected that the non-zero elements in the output result should move according to the specificed stride (here 3).
It does as I expected for first a few elements, but when I fed all zero array but the top-right element, it does not!

It skipped two top rows (i.e., all zeros for two top rows) and put the weight matrix into the output array starting from the third row and first column.

I suspect that this behavior might be a bug, isn’t it??


Hi @yjy765, I have executed the above code in colab but i got an error
Conv2DCustomBackpropInput: Size of out_backprop doesn't match computed: actual = 7, computed = 6 spatial_dim: 1 input: 18 filter: 8 output: 7 stride: 3 dilation: 1 [Op:Conv2DBackpropInput] which is due to the specified parameters don’t match with the input size, causing a mismatch in the output dimensions.

Could you please confirm you have tested with the same parameters in the conv2dTranspose layer?

Thank You.