Padding zero size tensors

Hi,

I got the following error when trying to pad zero size tensors.

torch.nn.functional.pad(torch.ones((0, 7)), (0, 8))
Out[29]: tensor([], size=(0, 15))

In [30]: torch.nn.functional.pad(torch.ones((0, 7)), (0, 0, 0, 0))
Out[30]: tensor([], size=(0, 7))


In [31]: torch.nn.functional.pad(torch.ones((0, 7)), [0, 0, 0, 3])                                                                                                                                                                               
Out[31]: 
tensor([[0., 0., 0., 0., 0., 0., 0.],
        [0., 0., 0., 0., 0., 0., 0.],
        [0., 0., 0., 0., 0., 0., 0.]])

In [32]: torch.nn.functional.pad(torch.ones((0, 7)), (0, 8, 0, 0))
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-31-b8dd95848884> in <module>
----> 1 torch.nn.functional.pad(torch.ones((0, 7)), (0, 8, 0, 0))

/home/hjj/.direnv/python-3.8.7/lib/python3.8/site-packages/torch/nn/functional.py in _pad(input, pad, mode, value)
   3998     assert len(pad) // 2 <= input.dim(), "Padding length too large"
   3999     if mode == "constant":
-> 4000         return _VF.constant_pad_nd(input, pad, value)
   4001     else:
   4002         assert value == 0, 'Padding mode "{}"" doesn\'t take in value argument'.format(mode)

RuntimeError: The input size 0, plus negative padding 0 and 0resulted in a negative output size, which is invalid. Check dimension 0of your input.

I expected the forth one will work since both the first three examples work. Any idea of why? Thanks.