mindspore.mint.exp2

View Source On AtomGit
mindspore.mint.exp2(input)[source]

Calculates the base-2 exponent of the tensor input element-wise.

\[out_i = 2^{\text{input}_i}\]
Parameters:

input (Tensor) – The input tensor.

Returns:

Tensor, which has the same shape as the input.

Raises:

TypeError – If input is not a Tensor.

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, mint
>>> x = Tensor(np.array([0.0, 1.0, 2.0, 4.0]), mindspore.float32)
>>> output = mint.exp2(x)
>>> print(output)
[ 1. 2. 4. 16.]