Shortcuts

# torch.polygamma¶

torch.polygamma(n, input, *, out=None) → Tensor

Computes the $n^{th}$ derivative of the digamma function on input. $n \geq 0$ is called the order of the polygamma function.

$\psi^{(n)}(x) = \frac{d^{(n)}}{dx^{(n)}} \psi(x)$

Note

This function is implemented only for nonnegative integers $n \geq 0$ .

Parameters
• n (int) – the order of the polygamma function

• input (Tensor) – the input tensor.

Keyword Arguments

out (Tensor, optional) – the output tensor.

Example::
>>> a = torch.tensor([1, 0.5])
>>> torch.polygamma(1, a)
tensor([1.64493, 4.9348])
>>> torch.polygamma(2, a)
tensor([ -2.4041, -16.8288])
>>> torch.polygamma(3, a)
tensor([ 6.4939, 97.4091])
>>> torch.polygamma(4, a)
tensor([ -24.8863, -771.4742])


## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources