log

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

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

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

  • name (str|None) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name

Returns

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

Return type

Tensor

Examples

>>> import paddle

>>> x = [[2, 3, 4], [7, 8, 9]]
>>> x = paddle.to_tensor(x, dtype='float32')
>>> print(paddle.log(x))
Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
[[0.69314718, 1.09861231, 1.38629436],
 [1.94591010, 2.07944155, 2.19722462]])