mindspore.ops.Log1p

class mindspore.ops.Log1p(*args, **kwargs)[source]

Returns the natural logarithm of one plus the input tensor element-wise.

Inputs:
  • input_x (Tensor) - The input tensor. With float16 or float32 data type. The value must be greater than -1.

Outputs:

Tensor, has the same shape as the input_x.

Raises

TypeError – If dtype of input_x is neither float16 nor float32.

Supported Platforms:

Ascend GPU

Examples

>>> input_x = Tensor(np.array([1.0, 2.0, 4.0]), mindspore.float32)
>>> log1p = ops.Log1p()
>>> output = log1p(input_x)
>>> print(output)
[0.6931472 1.0986123 1.609438 ]