scipy.special.exp2#
- scipy.special.exp2(x, out=None) = <ufunc 'exp2'>#
Compute
2**x
element-wise.- Parameters:
- xarray_like
x must contain real numbers.
- outndarray, optional
Optional output array for the function values
- Returns:
- scalar or ndarray
2**x
, computed element-wise.
Notes
Array API Standard Support
exp2
has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variableSCIPY_ARRAY_API=1
and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
✅
PyTorch
✅
⛔
JAX
⚠️ no JIT
⛔
Dask
✅
n/a
See Support for the array API standard for more information.
Examples
>>> import numpy as np >>> from scipy.special import exp2
>>> exp2(3) 8.0 >>> x = np.array([[-1, -0.5, 0], [0.5, 1, 1.5]]) >>> exp2(x) array([[ 0.5 , 0.70710678, 1. ], [ 1.41421356, 2. , 2.82842712]])