Hi,
The pad function is actually implemented in pure python for the functional package directly here 13. So it is not available from libtorch at the moment.
Note that the functions used in there though are implemented in libtorch. For example, constant padding can be done with constant_pad_nd() 44.