Hi! I convert weights from a pytorch model to tf2 model. For the conv2d, each feature map from tensorflow model is as same as that of pytorch. Thus, the conv2d are ok. However, for the deconvolution, the output of tensorflow deconvolution layer has black bars on the top and left hand side, whereas the pytorch one does not have these black bars. And it seems that the image is shift to right and down by 2 pixels.
Is that the mechanism of devolution in pytorch and tensorflow are different?
Here is the pytorch code:
nn.ConvTranspose2d(56, 1, kernel_size=9, stride=4, padding=9//2, output_padding=4-1)
tensorflow code:
tf.keras.layers.Conv2DTranspose(1, 9, strides=4, padding=‘same’)(x)
The conversion weights code from pytorch to tensorflow:
onnx_1_w_num = onnx_l.weight.data.permute(2,3,1,0).numpy()
onnx_1_b_num = onnx_l.bias.data.numpy()
tf_l.set_weights([onnx_1_w_num,onnx_1_b_num])

Please help. Thanks.