Is there function to replicate PadLayer

I am looking for a fucntion that works similar to PadLayer of tensorlayer. I can use numpy instead to do this, But would like to know if there is a torch equivalent to this PadLayer

torch.nn.functional.pad might do what you want.

No i cant use that I have already looked at it. But how do i pad a 4d tensor. You can look at the example in padlyer link in the question. More precisely i need reflect pading for 2nd and 3rd dims of 4d tensor

Archived what is needed.

torch_tensor.permute would bring the required dimensions to end and then apply a nn.functional.pad with reflect option on the 4d tensor for the last two dimensions. Later permute it back to its original form.