Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.digamma function

PyTorch torch.digamma function

PyTorch torch.digamma function


PyTorch torch reference manual PyTorch torch reference manual

torch.digamma is a PyTorch function for computing the psi function (logarithmic derivative) element-wise.

Function definition

torch.digamma(input, *, out=None)


Usage examples

Example

import

torch

Example of computing 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])


PyTorch torch reference manual PyTorch torch reference manual