log1p

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

Calculates the natural log of the given input tensor, element-wise.

\[Out = \ln(x+1)\]
Parameters
  • x (Tensor) – Input Tensor. Must be one of the following types: int32, int64, float16, bfloat16, float32, float64.

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

Returns

Tensor, the natural log of the input Tensor computed element-wise.

Examples

>>> import paddle

>>> data = paddle.to_tensor([[0], [1]], dtype='float32')
>>> res = paddle.log1p(data)
>>> res
Tensor(shape=[2, 1], dtype=float32, place=Place(cpu), stop_gradient=True,
[[0.        ],
 [0.69314718]])