mindspore.mint.special.exp2
- mindspore.mint.special.exp2(input)[source]
Calculates the base-2 exponent of the Tensor input element by element.
\[out_i = 2^{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.special.exp2(x) >>> print(output) [ 1. 2. 4. 16.]