PyTorch torch.lgamma Function


Pytorch torch 参考手册Pytorch torch Reference Manual

torch.lgammais a function in PyTorch used to compute the logarithm of the gamma function.

Function Definition

torch.lgamma(input, out=None)

Usage Example

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)
print("lgamma(x):", y)

The output result is:

lgamma(x): tensor([0.0000, 0.0000, 0.6931, 1.7918])

Pytorch torch 参考手册Pytorch torch Reference Manual

Other Extensions