mindspore.numpy.log2
- mindspore.numpy.log2(x, dtype=None)[源代码]
Base-2 logarithm of x.
Note
Numpy arguments out, where, casting, order, subok, signature, and extobj are not supported.
- Parameters
x (Tensor) – Input tensor.
dtype (
mindspore.dtype
, optional) – Default:None
. Overrides the dtype of the output Tensor.
- Returns
Tensor or scalar. This is a scalar if x is a scalar.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore.numpy as np >>> x = np.array([2, 4, 8]).astype('float16') >>> output = np.log2(x) >>> print(output) [1. 2. 3.]