mindspore.ops.Log

class mindspore.ops.Log[source]

Returns the natural logarithm of a tensor element-wise.

Refer to mindspore.ops.log() for more details.

Inputs:
  • x (Tensor) - Input Tensor of any dimension. The value must be greater than 0.

Outputs:

Tensor, has the same shape and dtype as the x.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> x = Tensor(np.array([1.0, 2.0, 4.0]), mindspore.float32)
>>> log = ops.Log()
>>> output = log(x)
>>> print(output)
[0.        0.6931472 1.3862944]