mindspore.ops.log10

mindspore.ops.log10(x)[source]

Returns a new tensor with the logarithm to the base 10 of the elements of input.

\[y_i = log_{10}(x_i)\]

Warning

If the input value of operator Log10 is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affacted. If the input value of operator Log10 is less than or equal to 0, it will not raise Error.

Note

The dimension of the input Tensor on Ascend should be less than or equal to 8, and the dimension of the input Tensor on the CPU or GPU should be less than 8.

Parameters

x (Tensor) – Input Tensor of any dimension. The value must be greater than 0.

Returns

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

Raises
  • TypeError – If x is not a Tensor.

  • TypeError – If dtype of x is not float16 or float32 or float64 on CPU and GPU.

  • TypeError – If dtype of x is not float16 or float32 on Ascend.

Supported Platforms:

Ascend GPU CPU

Examples

>>> x = Tensor(np.array([2, 4, 10]).astype(np.float16))
>>> output = ops.log10(x)
>>> print(output)
[0.301 0.602 1.   ]