I was re-writing a model in pytorch from tensorflow and came across of issues with padding. In the tensorflow model, the padding used in “SAME” and I tried to replicate that according to this:
After loading the tensorflow weights in, everything looks good until I hit the layers with “SAME” padding. I’ve read some previous post where others have had some trouble with replicating “SAME” padding in pytorch, but I haven’t come across posts where this was a problem when converting a tensorflow model to a pytorch model. The documentation on how “SAME” padding is calculated also didn’t seem to be very detailed (but maybe I’m looking at the wrong place).
For more info on the convolution layer, it is
in_channel = 526
out_channel = 64
input_shape = 140x140
kernel_size = 3x3
dilation = 1
stride = 2
Any advice or suggestions here would greatly help!