Scipy has a solution:
>>> import scipy.special
>>> import torch
>>> arr = torch.arange(5)
>>> arr
tensor([0, 1, 2, 3, 4])
>>> scipy.special.factorial(arr)
tensor([ 1.,  1.,  2.,  6., 24.], dtype=torch.float64)

This does not work with backprop / autograd, however.