PyTorch torch.lgamma function
PyTorch torch reference manual
torch.lgamma is a function in PyTorch used to compute the logarithm of the gamma function.
Function definition
torch.lgamma(input, out=None)
Usage examples
Example
import
torch
Compute the logarithm of the gamma function
x
=
torch.
tensor
(
[
1.0
,
2.0
,
3.0
,
4.0
]
)
y
=
torch.
lgamma
(
x
)
(
"lgamma(x):"
,
y
)
The output is:
lgamma(x): tensor([0.0000, 0.0000, 0.6931, 1.7918])