jax.numpy.float_power#
- jax.numpy.float_power(x, y, /)[source]#
Calculate element-wise base
x
exponential ofy
.JAX implementation of
numpy.float_power
.- Parameters:
x (ArrayLike) – scalar or array. Specifies the bases.
y (ArrayLike) – scalar or array. Specifies the exponents.
x
andy
should either have same shape or be broadcast compatible.
- Returns:
An array containing the base
x
exponentials ofy
, promoting to the inexact dtype.- Return type:
See also
jax.numpy.exp()
: Calculates element-wise exponential of the input.jax.numpy.exp2()
: Calculates base-2 exponential of each element of the input.
Examples
Inputs with same shape:
>>> x = jnp.array([3, 1, -5]) >>> y = jnp.array([2, 4, -1]) >>> jnp.float_power(x, y) Array([ 9. , 1. , -0.2], dtype=float32)
Inputs with broacast compatibility:
>>> x1 = jnp.array([[2, -4, 1], ... [-1, 2, 3]]) >>> y1 = jnp.array([-2, 1, 4]) >>> jnp.float_power(x1, y1) Array([[ 0.25, -4. , 1. ], [ 1. , 2. , 81. ]], dtype=float32)
jnp.float_power
producesnan
for negative values raised to a non-integer values.>>> jnp.float_power(-3, 1.7) Array(nan, dtype=float32, weak_type=True)