log10

paddle. log10 ( x, name=None ) [source]

Calculates the log to the base 10 of the given input tensor, element-wise.

\[Out = \log_10_x\]
Parameters
  • x (Tensor) – Input tensor must be one of the following types: int32, int64, float16, bfloat16, float32, float64, complex64, complex128.

  • name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.

Returns

The log to the base 10 of the input Tensor computed element-wise.

Return type

Tensor

Examples

>>> import paddle

>>> # example 1: x is a float
>>> x_i = paddle.to_tensor([[1.0], [10.0]])
>>> res = paddle.log10(x_i)
>>> res
Tensor(shape=[2, 1], dtype=float32, place=Place(cpu), stop_gradient=True,
[[0.],
 [1.]])

>>> # example 2: x is float32
>>> x_i = paddle.full(shape=[1], fill_value=10, dtype='float32')
>>> paddle.to_tensor(x_i)
>>> res = paddle.log10(x_i)
>>> res
Tensor(shape=[1], dtype=float32, place=Place(cpu), stop_gradient=True,
[1.])

>>> # example 3: x is float64
>>> x_i = paddle.full(shape=[1], fill_value=10, dtype='float64')
>>> paddle.to_tensor(x_i)
>>> res = paddle.log10(x_i)
>>> res
Tensor(shape=[1], dtype=float64, place=Place(cpu), stop_gradient=True,
[1.])