mindspore.ops.log2

View Source On Gitee
mindspore.ops.log2(input)[source]

Compute the logarithm to the base 2 of the input tensor element-wise.

yi=log2(inputi)

Warning

If the input value of operator log2 is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may be affected.

Parameters

input (Tensor) – The input tensor.

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> x = mindspore.tensor([2, 4, 8], mindspore.float16)
>>> output = mindspore.ops.log2(x)
>>> print(output)
[1. 2. 3.]