mindspore.Tensor.log1p
- Tensor.log1p() Tensor
Returns the natural logarithm of one plus the self tensor element-wise.
\[out_i = \log_e(x_i + 1)\]Note
The input Tensor. \(x\) in the above formula. The value must be greater than -1.
- Returns
Tensor, has the same shape as the self.
- Raises
TypeError – If self is not a Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor >>> x = Tensor(np.array([1.0, 2.0, 4.0]), mindspore.float32) >>> output = x.log1p() >>> print(output) [0.6931472 1.0986123 1.609438 ]