I try to copy the weights from a pytorch model to tf2 model. I can successfully do the influence. I output the feature map to have a look. However, the feature map after a conv2d has black bars on the top and left hand side of the map.
i-stack-imgur-com/E45K6.png
The pytorch feature map does not have these black bars. The pytorch code of conv2d is nn.Conv2d(1, 56, kernel_size=5, padding=5//2) The tensorflow build is Conv2D(56, 5, padding=“same”)(inp) The copying weight from pytorch model to tf2 is :
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])
What is wrong? Thanks.