mindspore.ops.polygamma

mindspore.ops.polygamma(n, input)[source]

Computes the \(n\)-th derivative of the polygamma function on input.

\[\psi^{(n)}(x) = \frac{d^{(n)}}{dx^{(n)}} \psi(x)\]

where \(\psi(x)\) is the digamma function.

Parameters
  • n (Tensor) – The order of the polygamma function. Supported dtypes: int32, int64. The shape of n is \(()\).

  • input (Tensor) – The tensor to compute the \(n\)-th derivative of the polygamma function with.

Returns

Tensor, has the same dtype as input.

Raises
  • TypeError – If input is not a Tensor.

  • TypeError – If dtype of input is not one of: float16, float32, float64.

  • TypeError – If dtype of n is not one of: int32, int64.

  • TypeError – If shape of n is not \(()\).

Supported Platforms:

GPU CPU

Examples

>>> x = Tensor(np.array([3.14, -2.71]), mindspore.float64)
>>> a = Tensor(np.array(1), mindspore.int64)
>>> output = ops.polygamma(a, x)
>>> print(output)
[ 0.37446456 15.49884838]