@gfotedar There’s no direct way of padding with a non-zero value, but there are some workarounds you can try. Of course, it depends on your use case whether these workarounds are good enough for you.
I think the easiest one is this:
Suppose you want to use a padding value of val.  Start by subtracting val from the input image you’re intending to sample. Then pass to grid_sample() with padding_mode="zeros". Then just add back val to the result.
There are other, more complicated ways, like adding a border to your image and using "border" padding, but I would highly recommend not doing this since you’d have to adjust the grid to match, and it’s just very easy to get it wrong.
What is it specifically that you’re trying to acomplish, by the way?