>>> import torch as to
>>> import torch.nn.functional as fu
>>> a=to.randn(3,2,5)
>>> _=fu.pad(a[:, 1:], (0,0,1,0,), mode='constant')  # works!
>>> _=fu.pad(a[:, 1:], (0,0,1,0,), mode='replicate')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/torch/nn/functional.py", line 2852, in pad
    assert len(pad) == 2, '3D tensors expect 2 values for padding'
AssertionError: 3D tensors expect 2 values for padding

Am I doing something wrong?