polygamma¶
- paddle. polygamma ( x, n, name=None ) [source]
-
Calculates the polygamma of the given input tensor, element-wise.
The equation is:
\[\Phi^n(x) = \frac{d^n}{dx^n} [\ln(\Gamma(x))]\]- Parameters
-
x (Tensor) – Input Tensor. Must be one of the following types: float32, float64.
n (int) – Order of the derivative. Must be integral.
name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.
- Returns
-
out (Tensor), A Tensor. the polygamma of the input Tensor, the shape and data type is the same with input.
Examples
import paddle data = paddle.to_tensor([2, 3, 25.5], dtype='float32') res = paddle.polygamma(data, 1) print(res) # Tensor(shape=[2], dtype=float32, place=CUDAPlace(0), stop_gradient=True, # [0.64493407, 0.39493407, 0.03999467])