Shortcuts

torch.polygamma

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

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

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

Note

This function is not implemented for n2n \geq 2 .

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

  • input (Tensor) – the input tensor.

  • out (Tensor, optional) – the output tensor.

Example::
>>> a = torch.tensor([1, 0.5])
>>> torch.polygamma(1, a)
tensor([1.64493, 4.9348])

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