mindspore.ops.Digamma

View Source On Gitee
class mindspore.ops.Digamma[source]

Computes the grad of the lgamma function on input.

\[P(x) = grad(ln(gamma(x)))\]

Warning

This is an experimental API that is subject to change or deletion.

Inputs:
  • x (Tensor) - The input tensor. With type of float16 or float32 or float64.

Outputs:

Tensor, has the same dtype as x.

Raises
  • TypeError – If x is not a Tensor.

  • TypeError – If dtype of input x is not float16 or float32 or float64.

Supported Platforms:

GPU CPU

Examples

>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> x = Tensor(np.array([1.5, 0.5, 9]).astype(np.float16))
>>> digamma = ops.Digamma()
>>> output = digamma(x)
>>> print(output)
[ 0.0365 -1.964   2.14  ]