paddle. lgamma ( x, name=None ) [source]

Calculates the lgamma of the given input tensor, element-wise.

This operator performs elementwise lgamma for input $X$. \(out = log\Gamma(x)\)

  • x (Tensor) – Input Tensor. Must be one of the following types: float16, float32, float64, uint16.

  • name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.


Tensor, the lgamma of the input Tensor, the shape and data type is the same with input.


>>> import paddle

>>> x = paddle.to_tensor([-0.4, -0.2, 0.1, 0.3])
>>> out = paddle.lgamma(x)
>>> out
Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
[1.31452453, 1.76149762, 2.25271273, 1.09579790])