mindspore.ops.Log
- class mindspore.ops.Log(*args, **kwargs)[source]
Returns the natural logarithm of a tensor element-wise.
\[y_i = log_e(x_i)\]- Inputs:
input_x (Tensor) - The input tensor. The value must be greater than 0.
- Outputs:
Tensor, has the same shape as the input_x.
- Raises
TypeError – If input_x is not a Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> input_x = Tensor(np.array([1.0, 2.0, 4.0]), mindspore.float32) >>> log = ops.Log() >>> output = log(input_x) >>> print(output) [0. 0.6931472 1.3862944]