From the docs:

Constant padding is implemented for arbitrary dimensions.
Replicate padding is implemented for padding the last 3 dimensions of 5D input
tensor, or the last 2 dimensions of 4D input tensor, or the last dimension of
3D input tensor. Reflect padding is only implemented for padding the last 2
dimensions of 4D input tensor, or the last dimension of 3D input tensor.

Your batch and channel dimensions should be 1 in this case.
Try to add them via:
input = input.unsqueeze(0).unsqueeze(1)

and rerun your code.