jax.numpy.exp2#
- jax.numpy.exp2(x, /)[source]#
Calculate element-wise base-2 exponential of input.
JAX implementation of
numpy.exp2
.- Parameters:
x (ArrayLike) – input array or scalar
- Returns:
An array containing the base-2 exponential of each element in
x
, promotes to inexact dtype.- Return type:
See also
jax.numpy.log2()
: Calculates base-2 logarithm of each element of input.jax.numpy.exp()
: Calculates exponential of each element of the input.jax.numpy.expm1()
: Calculates \(e^x-1\) of each element of the input.
Examples
jnp.exp2
follows the properties of the exponential such as \(2^{a+b} = 2^a * 2^b\).>>> x1 = jnp.array([2, -4, 3, -1]) >>> x2 = jnp.array([-1, 3, -2, 3]) >>> jnp.exp2(x1+x2) Array([2. , 0.5, 2. , 4. ], dtype=float32) >>> jnp.exp2(x1)*jnp.exp2(x2) Array([2. , 0.5, 2. , 4. ], dtype=float32)