log2¶

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

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

$\begin{split}Out = \\log_2x\end{split}$
Parameters
• x (Tensor) – Input tensor must be one of the following types: float32, float64.

• name (str|None) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name

Returns

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

Return type

Tensor

Examples

import paddle

# example 1: x is a float
res = paddle.log2(x_i) # [[0.], [1.0]]

# example 2: x is float32