Padding other value (i.e., 255 instead of 0) in Pytorch grid_sample

Hi, I wonder how to pad other values in the grid_sample function instead of 0, could you give me some advice?

I think I get a solution. We can firstly map the tensor through y = x-255, when we apply the grid_sample for y, we can use z = y+255 to get the padding effect of 255

1 Like