PyTorch torch.digamma function
Pytorch torch Reference Manual
torch.digammaIt is a function in PyTorch used for element-wise computation of the psi function (logarithmic derivative).
Function Definition
torch.digamma(input, *, out=None)
Usage Example
Example
import torch
# Example of calculating the psi function
x = torch.tensor([1.0, 2.0, 3.0, 4.0], dtype=torch.float32)
result = torch.digamma(x)
print(result) # tensor([-0.5772, 0.4228, 1.2561, 2.0312])
# Example of calculating the psi function
x = torch.tensor([1.0, 2.0, 3.0, 4.0], dtype=torch.float32)
result = torch.digamma(x)
print(result) # tensor([-0.5772, 0.4228, 1.2561, 2.0312])
Other Extensions