Grid_sampling padding mode

I am a big fan of the grid_sampling method in

https://pytorch.org/docs/master/generated/torch.nn.functional.grid_sample.html#torch.nn.functional.grid_sample

I now face a case, where all my images have white background, but the padding mode only allows for zero padding (black). Can someone guide me through the steps for extending the function with constant padding (e.g. all white)?