Shortcuts

torch.mvlgamma

torch.mvlgamma(input, p) → Tensor

Computes the multivariate log-gamma function) with dimension pp element-wise, given by

log(Γp(a))=C+i=1plog(Γ(ai12))\log(\Gamma_{p}(a)) = C + \displaystyle \sum_{i=1}^{p} \log\left(\Gamma\left(a - \frac{i - 1}{2}\right)\right)

where C=log(π)×p(p1)4C = \log(\pi) \times \frac{p (p - 1)}{4} and Γ()\Gamma(\cdot) is the Gamma function.

All elements must be greater than p12\frac{p - 1}{2} , otherwise an error would be thrown.

Parameters
  • input (Tensor) – the tensor to compute the multivariate log-gamma function

  • p (int) – the number of dimensions

Example:

>>> a = torch.empty(2, 3).uniform_(1, 2)
>>> a
tensor([[1.6835, 1.8474, 1.1929],
        [1.0475, 1.7162, 1.4180]])
>>> torch.mvlgamma(a, 2)
tensor([[0.3928, 0.4007, 0.7586],
        [1.0311, 0.3901, 0.5049]])

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