我要评分
获取效率
正确性
完整性
易理解

exp2

Description

Calculate the base-2 exponential of each element in the input. That is, .

Mandatory Input Parameters

Parameter

Type

Description

x

array_like

Input array or scalar

Optional Input Parameters

Parameter

Type

Default Value

Description

out

ndarray/ndarray tuple

None

Location where the calculation result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided, a freshly-allocated array is returned.

where

array_like

None

This condition is broadcast over the input. At locations where the condition is true, the out array stores the result. Elsewhere, the out array retains its original value.

**kwargs

-

-

Other keyword arguments. Refer to the NumPy official document Universal functions (ufunc).

Return Value

Type

Description

ndarray/scalar

Element-wise base-2 exponential of x

Examples

>>> import numpy as np
>>> 
>>> np.exp2(4)
16.0
>>> 
>>> np.exp2([1, 2, 3])
array([2., 4., 8.])
>>>