mindspore.ops.exp2

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

Computes base two exponential of Tensor input element-wise.

\[out_i = 2^{input_i}\]
Parameters

input (Tensor) – Input tensor.

Returns

Tensor, has the same shape and dtype as the input.

Raises

TypeError – If input is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> x = Tensor(np.array([2, 3, 4]), mindspore.float32)
>>> output = ops.exp2(x)
>>> print(output)
[ 4.  8. 16.]