code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def polysub(a1: ArrayLike, a2: ArrayLike) -> Array:
r"""Returns the difference of two polynomials.
JAX implementation of :func:`numpy.polysub`.
Args:
a1: Array of minuend polynomial coefficients.
a2: Array of subtrahend polynomial coefficients.
Returns:
An array containing the coefficients of the... | Returns the difference of two polynomials.
JAX implementation of :func:`numpy.polysub`.
Args:
a1: Array of minuend polynomial coefficients.
a2: Array of subtrahend polynomial coefficients.
Returns:
An array containing the coefficients of the difference of two polynomials.
Note:
:func:`jax.nu... | polysub | python | jax-ml/jax | jax/_src/numpy/polynomial.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/polynomial.py | Apache-2.0 |
def sum(a: ArrayLike, axis: Axis = None, dtype: DTypeLike | None = None,
out: None = None, keepdims: bool = False, initial: ArrayLike | None = None,
where: ArrayLike | None = None, promote_integers: bool = True) -> Array:
r"""Sum of the elements of the array over a given axis.
JAX implementation of... | Sum of the elements of the array over a given axis.
JAX implementation of :func:`numpy.sum`.
Args:
a: Input array.
axis: int or array, default=None. Axis along which the sum to be computed.
If None, the sum is computed along all the axes.
dtype: The type of the output array. Default=None.
ou... | sum | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def prod(a: ArrayLike, axis: Axis = None, dtype: DTypeLike | None = None,
out: None = None, keepdims: bool = False,
initial: ArrayLike | None = None, where: ArrayLike | None = None,
promote_integers: bool = True) -> Array:
r"""Return product of the array elements over a given axis.
JAX i... | Return product of the array elements over a given axis.
JAX implementation of :func:`numpy.prod`.
Args:
a: Input array.
axis: int or array, default=None. Axis along which the product to be computed.
If None, the product is computed along all the axes.
dtype: The type of the output array. Default... | prod | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def max(a: ArrayLike, axis: Axis = None, out: None = None,
keepdims: bool = False, initial: ArrayLike | None = None,
where: ArrayLike | None = None) -> Array:
r"""Return the maximum of the array elements along a given axis.
JAX implementation of :func:`numpy.max`.
Args:
a: Input array.
a... | Return the maximum of the array elements along a given axis.
JAX implementation of :func:`numpy.max`.
Args:
a: Input array.
axis: int or array, default=None. Axis along which the maximum to be computed.
If None, the maximum is computed along all the axes.
keepdims: bool, default=False. If true, ... | max | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def min(a: ArrayLike, axis: Axis = None, out: None = None,
keepdims: bool = False, initial: ArrayLike | None = None,
where: ArrayLike | None = None) -> Array:
r"""Return the minimum of array elements along a given axis.
JAX implementation of :func:`numpy.min`.
Args:
a: Input array.
axis:... | Return the minimum of array elements along a given axis.
JAX implementation of :func:`numpy.min`.
Args:
a: Input array.
axis: int or array, default=None. Axis along which the minimum to be computed.
If None, the minimum is computed along all the axes.
keepdims: bool, default=False. If true, redu... | min | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def all(a: ArrayLike, axis: Axis = None, out: None = None,
keepdims: bool = False, *, where: ArrayLike | None = None) -> Array:
r"""Test whether all array elements along a given axis evaluate to True.
JAX implementation of :func:`numpy.all`.
Args:
a: Input array.
axis: int or array, default=None... | Test whether all array elements along a given axis evaluate to True.
JAX implementation of :func:`numpy.all`.
Args:
a: Input array.
axis: int or array, default=None. Axis along which to be tested. If None,
tests along all the axes.
keepdims: bool, default=False. If true, reduced axes are left in... | all | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def any(a: ArrayLike, axis: Axis = None, out: None = None,
keepdims: bool = False, *, where: ArrayLike | None = None) -> Array:
r"""Test whether any of the array elements along a given axis evaluate to True.
JAX implementation of :func:`numpy.any`.
Args:
a: Input array.
axis: int or array, defau... | Test whether any of the array elements along a given axis evaluate to True.
JAX implementation of :func:`numpy.any`.
Args:
a: Input array.
axis: int or array, default=None. Axis along which to be tested. If None,
tests along all the axes.
keepdims: bool, default=False. If true, reduced axes are ... | any | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def _logsumexp(a: ArrayLike, axis: Axis = None, dtype: DTypeLike | None = None,
out: None = None, keepdims: bool = False,
initial: ArrayLike | None = None, where: ArrayLike | None = None) -> Array:
"""Compute log(sum(exp(a))) while avoiding precision loss."""
if out is not None:
ra... | Compute log(sum(exp(a))) while avoiding precision loss. | _logsumexp | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def amin(a: ArrayLike, axis: Axis = None, out: None = None,
keepdims: bool = False, initial: ArrayLike | None = None,
where: ArrayLike | None = None) -> Array:
"""Alias of :func:`jax.numpy.min`."""
return min(a, axis=axis, out=out, keepdims=keepdims,
initial=initial, where=where) | Alias of :func:`jax.numpy.min`. | amin | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def amax(a: ArrayLike, axis: Axis = None, out: None = None,
keepdims: bool = False, initial: ArrayLike | None = None,
where: ArrayLike | None = None) -> Array:
"""Alias of :func:`jax.numpy.max`."""
return max(a, axis=axis, out=out, keepdims=keepdims,
initial=initial, where=where) | Alias of :func:`jax.numpy.max`. | amax | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def mean(a: ArrayLike, axis: Axis = None, dtype: DTypeLike | None = None,
out: None = None, keepdims: bool = False, *,
where: ArrayLike | None = None) -> Array:
r"""Return the mean of array elements along a given axis.
JAX implementation of :func:`numpy.mean`.
Args:
a: input array.
axi... | Return the mean of array elements along a given axis.
JAX implementation of :func:`numpy.mean`.
Args:
a: input array.
axis: optional, int or sequence of ints, default=None. Axis along which the
mean to be computed. If None, mean is computed along all the axes.
dtype: The type of the output array... | mean | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def average(a: ArrayLike, axis: Axis = None, weights: ArrayLike | None = None,
returned: bool = False, keepdims: bool = False) -> Array | tuple[Array, Array]:
"""Compute the weighed average.
JAX Implementation of :func:`numpy.average`.
Args:
a: array to be averaged
axis: an optional integer ... | Compute the weighed average.
JAX Implementation of :func:`numpy.average`.
Args:
a: array to be averaged
axis: an optional integer or sequence of integers specifying the axis along which
the mean to be computed. If not specified, mean is computed along all the axes.
weights: an optional array of ... | average | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def var(a: ArrayLike, axis: Axis = None, dtype: DTypeLike | None = None,
out: None = None, ddof: int = 0, keepdims: bool = False, *,
where: ArrayLike | None = None, correction: int | float | None = None) -> Array:
r"""Compute the variance along a given axis.
JAX implementation of :func:`numpy.var`.... | Compute the variance along a given axis.
JAX implementation of :func:`numpy.var`.
Args:
a: input array.
axis: optional, int or sequence of ints, default=None. Axis along which the
variance is computed. If None, variance is computed along all the axes.
dtype: The type of the output array. Default... | var | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def std(a: ArrayLike, axis: Axis = None, dtype: DTypeLike | None = None,
out: None = None, ddof: int = 0, keepdims: bool = False, *,
where: ArrayLike | None = None, correction: int | float | None = None) -> Array:
r"""Compute the standard deviation along a given axis.
JAX implementation of :func:`n... | Compute the standard deviation along a given axis.
JAX implementation of :func:`numpy.std`.
Args:
a: input array.
axis: optional, int or sequence of ints, default=None. Axis along which the
standard deviation is computed. If None, standard deviaiton is computed
along all the axes.
dtype: T... | std | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def ptp(a: ArrayLike, axis: Axis = None, out: None = None,
keepdims: bool = False) -> Array:
r"""Return the peak-to-peak range along a given axis.
JAX implementation of :func:`numpy.ptp`.
Args:
a: input array.
axis: optional, int or sequence of ints, default=None. Axis along which the
rang... | Return the peak-to-peak range along a given axis.
JAX implementation of :func:`numpy.ptp`.
Args:
a: input array.
axis: optional, int or sequence of ints, default=None. Axis along which the
range is computed. If None, the range is computed on the flattened array.
keepdims: bool, default=False. If... | ptp | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def count_nonzero(a: ArrayLike, axis: Axis = None,
keepdims: bool = False) -> Array:
r"""Return the number of nonzero elements along a given axis.
JAX implementation of :func:`numpy.count_nonzero`.
Args:
a: input array.
axis: optional, int or sequence of ints, default=None. Axis along ... | Return the number of nonzero elements along a given axis.
JAX implementation of :func:`numpy.count_nonzero`.
Args:
a: input array.
axis: optional, int or sequence of ints, default=None. Axis along which the
number of nonzeros are counted. If None, counts within the flattened array.
keepdims: boo... | count_nonzero | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nanmin(a: ArrayLike, axis: Axis = None, out: None = None,
keepdims: bool = False, initial: ArrayLike | None = None,
where: ArrayLike | None = None) -> Array:
r"""Return the minimum of the array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanmin`.
Args... | Return the minimum of the array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanmin`.
Args:
a: Input array.
axis: int or sequence of ints, default=None. Axis along which the minimum is
computed. If None, the minimum is computed along the flattened array.
keepdim... | nanmin | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nanmax(a: ArrayLike, axis: Axis = None, out: None = None,
keepdims: bool = False, initial: ArrayLike | None = None,
where: ArrayLike | None = None) -> Array:
r"""Return the maximum of the array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanmax`.
Args... | Return the maximum of the array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanmax`.
Args:
a: Input array.
axis: int or sequence of ints, default=None. Axis along which the maximum is
computed. If None, the maximum is computed along the flattened array.
keepdim... | nanmax | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nansum(a: ArrayLike, axis: Axis = None, dtype: DTypeLike | None = None, out: None = None,
keepdims: bool = False, initial: ArrayLike | None = None,
where: ArrayLike | None = None) -> Array:
r"""Return the sum of the array elements along a given axis, ignoring NaNs.
JAX implementation of :... | Return the sum of the array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nansum`.
Args:
a: Input array.
axis: int or sequence of ints, default=None. Axis along which the sum is
computed. If None, the sum is computed along the flattened array.
dtype: The type of ... | nansum | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nanprod(a: ArrayLike, axis: Axis = None, dtype: DTypeLike | None = None, out: None = None,
keepdims: bool = False, initial: ArrayLike | None = None,
where: ArrayLike | None = None) -> Array:
r"""Return the product of the array elements along a given axis, ignoring NaNs.
JAX implementati... | Return the product of the array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanprod`.
Args:
a: Input array.
axis: int or sequence of ints, default=None. Axis along which the product is
computed. If None, the product is computed along the flattened array.
dtype:... | nanprod | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nanmean(a: ArrayLike, axis: Axis = None, dtype: DTypeLike | None = None, out: None = None,
keepdims: bool = False, where: ArrayLike | None = None) -> Array:
r"""Return the mean of the array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanmean`.
Args:
a: Inpu... | Return the mean of the array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanmean`.
Args:
a: Input array.
axis: int or sequence of ints, default=None. Axis along which the mean is
computed. If None, the mean is computed along the flattened array.
dtype: The type... | nanmean | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nanvar(a: ArrayLike, axis: Axis = None, dtype: DTypeLike | None = None, out: None = None,
ddof: int = 0, keepdims: bool = False,
where: ArrayLike | None = None) -> Array:
r"""Compute the variance of array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanva... | Compute the variance of array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanvar`.
Args:
a: input array.
axis: optional, int or sequence of ints, default=None. Axis along which the
variance is computed. If None, variance is computed along flattened array.
dtype... | nanvar | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nanstd(a: ArrayLike, axis: Axis = None, dtype: DTypeLike | None = None, out: None = None,
ddof: int = 0, keepdims: bool = False,
where: ArrayLike | None = None) -> Array:
r"""Compute the standard deviation along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanstd`.
A... | Compute the standard deviation along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanstd`.
Args:
a: input array.
axis: optional, int or sequence of ints, default=None. Axis along which the
standard deviation is computed. If None, standard deviaiton is computed
along flattene... | nanstd | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def _cumulative_reduction(
name: str, reduction: Callable[..., Array],
a: ArrayLike, axis: int | None, dtype: DTypeLike | None, out: None = None,
fill_nan: bool = False, fill_value: ArrayLike = 0,
promote_integers: bool = False) -> Array:
"""Helper function for implementing cumulative reductions."""
... | Helper function for implementing cumulative reductions. | _cumulative_reduction | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def cumsum(a: ArrayLike, axis: int | None = None,
dtype: DTypeLike | None = None, out: None = None) -> Array:
"""Cumulative sum of elements along an axis.
JAX implementation of :func:`numpy.cumsum`.
Args:
a: N-dimensional array to be accumulated.
axis: integer axis along which to accumulate. ... | Cumulative sum of elements along an axis.
JAX implementation of :func:`numpy.cumsum`.
Args:
a: N-dimensional array to be accumulated.
axis: integer axis along which to accumulate. If None (default), then
array will be flattened and accumulated along the flattened axis.
dtype: optionally specify ... | cumsum | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def cumprod(a: ArrayLike, axis: int | None = None,
dtype: DTypeLike | None = None, out: None = None) -> Array:
"""Cumulative product of elements along an axis.
JAX implementation of :func:`numpy.cumprod`.
Args:
a: N-dimensional array to be accumulated.
axis: integer axis along which to accum... | Cumulative product of elements along an axis.
JAX implementation of :func:`numpy.cumprod`.
Args:
a: N-dimensional array to be accumulated.
axis: integer axis along which to accumulate. If None (default), then
array will be flattened and accumulated along the flattened axis.
dtype: optionally spe... | cumprod | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nancumsum(a: ArrayLike, axis: int | None = None,
dtype: DTypeLike | None = None, out: None = None) -> Array:
"""Cumulative sum of elements along an axis, ignoring NaN values.
JAX implementation of :func:`numpy.nancumsum`.
Args:
a: N-dimensional array to be accumulated.
axis: integer ax... | Cumulative sum of elements along an axis, ignoring NaN values.
JAX implementation of :func:`numpy.nancumsum`.
Args:
a: N-dimensional array to be accumulated.
axis: integer axis along which to accumulate. If None (default), then
array will be flattened and accumulated along the flattened axis.
dt... | nancumsum | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nancumprod(a: ArrayLike, axis: int | None = None,
dtype: DTypeLike | None = None, out: None = None) -> Array:
"""Cumulative product of elements along an axis, ignoring NaN values.
JAX implementation of :func:`numpy.nancumprod`.
Args:
a: N-dimensional array to be accumulated.
axis: int... | Cumulative product of elements along an axis, ignoring NaN values.
JAX implementation of :func:`numpy.nancumprod`.
Args:
a: N-dimensional array to be accumulated.
axis: integer axis along which to accumulate. If None (default), then
array will be flattened and accumulated along the flattened axis.
... | nancumprod | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def _cumsum_with_promotion(a: ArrayLike, axis: int | None = None,
dtype: DTypeLike | None = None, out: None = None) -> Array:
"""Utility function to compute cumsum with integer promotion."""
return _cumulative_reduction("_cumsum_with_promotion", lax.cumsum,
a, axis, dtype, ... | Utility function to compute cumsum with integer promotion. | _cumsum_with_promotion | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def cumulative_sum(
x: ArrayLike, /, *, axis: int | None = None,
dtype: DTypeLike | None = None,
include_initial: bool = False) -> Array:
"""Cumulative sum along the axis of an array.
JAX implementation of :func:`numpy.cumulative_sum`.
Args:
x: N-dimensional array
axis: integer axis along wh... | Cumulative sum along the axis of an array.
JAX implementation of :func:`numpy.cumulative_sum`.
Args:
x: N-dimensional array
axis: integer axis along which to accumulate. If ``x`` is one-dimensional,
this argument is optional and defaults to zero.
dtype: optional dtype of the output.
include_... | cumulative_sum | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def cumulative_prod(
x: ArrayLike, /, *, axis: int | None = None,
dtype: DTypeLike | None = None,
include_initial: bool = False) -> Array:
"""Cumulative product along the axis of an array.
JAX implementation of :func:`numpy.cumulative_prod`.
Args:
x: N-dimensional array
axis: integer axis al... | Cumulative product along the axis of an array.
JAX implementation of :func:`numpy.cumulative_prod`.
Args:
x: N-dimensional array
axis: integer axis along which to accumulate. If ``x`` is one-dimensional,
this argument is optional and defaults to zero.
dtype: optional dtype of the output.
inc... | cumulative_prod | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def quantile(a: ArrayLike, q: ArrayLike, axis: int | tuple[int, ...] | None = None,
out: None = None, overwrite_input: bool = False, method: str = "linear",
keepdims: bool = False, *, interpolation: DeprecatedArg | str = DeprecatedArg()) -> Array:
"""Compute the quantile of the data along th... | Compute the quantile of the data along the specified axis.
JAX implementation of :func:`numpy.quantile`.
Args:
a: N-dimensional array input.
q: scalar or 1-dimensional array specifying the desired quantiles. ``q``
should contain floating-point values between ``0.0`` and ``1.0``.
axis: optional a... | quantile | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nanquantile(a: ArrayLike, q: ArrayLike, axis: int | tuple[int, ...] | None = None,
out: None = None, overwrite_input: bool = False, method: str = "linear",
keepdims: bool = False, *, interpolation: DeprecatedArg | str = DeprecatedArg()) -> Array:
"""Compute the quantile of the data... | Compute the quantile of the data along the specified axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanquantile`.
Args:
a: N-dimensional array input.
q: scalar or 1-dimensional array specifying the desired quantiles. ``q``
should contain floating-point values between ``0.0`` and ``1.0``.
... | nanquantile | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def percentile(a: ArrayLike, q: ArrayLike,
axis: int | tuple[int, ...] | None = None,
out: None = None, overwrite_input: bool = False, method: str = "linear",
keepdims: bool = False, *, interpolation: str | DeprecatedArg = DeprecatedArg()) -> Array:
"""Compute the percenti... | Compute the percentile of the data along the specified axis.
JAX implementation of :func:`numpy.percentile`.
Args:
a: N-dimensional array input.
q: scalar or 1-dimensional array specifying the desired quantiles. ``q``
should contain integer or floating point values between ``0`` and ``100``.
axi... | percentile | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nanpercentile(a: ArrayLike, q: ArrayLike,
axis: int | tuple[int, ...] | None = None,
out: None = None, overwrite_input: bool = False, method: str = "linear",
keepdims: bool = False, *, interpolation: str | DeprecatedArg = DeprecatedArg()) -> Array:
"""Compute ... | Compute the percentile of the data along the specified axis, ignoring NaN values.
JAX implementation of :func:`numpy.nanpercentile`.
Args:
a: N-dimensional array input.
q: scalar or 1-dimensional array specifying the desired quantiles. ``q``
should contain integer or floating point values between ``... | nanpercentile | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def median(a: ArrayLike, axis: int | tuple[int, ...] | None = None,
out: None = None, overwrite_input: bool = False,
keepdims: bool = False) -> Array:
r"""Return the median of array elements along a given axis.
JAX implementation of :func:`numpy.median`.
Args:
a: input array.
axis:... | Return the median of array elements along a given axis.
JAX implementation of :func:`numpy.median`.
Args:
a: input array.
axis: optional, int or sequence of ints, default=None. Axis along which the
median to be computed. If None, median is computed for the flattened array.
keepdims: bool, defaul... | median | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def nanmedian(a: ArrayLike, axis: int | tuple[int, ...] | None = None,
out: None = None, overwrite_input: bool = False,
keepdims: bool = False) -> Array:
r"""Return the median of array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanmedian`.
Args:
... | Return the median of array elements along a given axis, ignoring NaNs.
JAX implementation of :func:`numpy.nanmedian`.
Args:
a: input array.
axis: optional, int or sequence of ints, default=None. Axis along which the
median to be computed. If None, median is computed for the flattened array.
keep... | nanmedian | python | jax-ml/jax | jax/_src/numpy/reductions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/reductions.py | Apache-2.0 |
def _concat_unique(arr1: Array, arr2: Array) -> tuple[Array, Array]:
"""Utility to concatenate the unique values from two arrays."""
arr1, arr2 = ravel(arr1), ravel(arr2)
arr1, num_unique1 = _unique(arr1, axis=0, size=arr1.size, return_true_size=True)
arr2, num_unique2 = _unique(arr2, axis=0, size=arr2.size, re... | Utility to concatenate the unique values from two arrays. | _concat_unique | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def setdiff1d(ar1: ArrayLike, ar2: ArrayLike, assume_unique: bool = False,
*, size: int | None = None, fill_value: ArrayLike | None = None) -> Array:
"""Compute the set difference of two 1D arrays.
JAX implementation of :func:`numpy.setdiff1d`.
Because the size of the output of ``setdiff1d`` is da... | Compute the set difference of two 1D arrays.
JAX implementation of :func:`numpy.setdiff1d`.
Because the size of the output of ``setdiff1d`` is data-dependent, the function
is not typically compatible with :func:`~jax.jit` and other JAX transformations.
The JAX version adds the optional ``size`` argument which... | setdiff1d | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def union1d(ar1: ArrayLike, ar2: ArrayLike,
*, size: int | None = None, fill_value: ArrayLike | None = None) -> Array:
"""Compute the set union of two 1D arrays.
JAX implementation of :func:`numpy.union1d`.
Because the size of the output of ``union1d`` is data-dependent, the function
is not typica... | Compute the set union of two 1D arrays.
JAX implementation of :func:`numpy.union1d`.
Because the size of the output of ``union1d`` is data-dependent, the function
is not typically compatible with :func:`~jax.jit` and other JAX transformations.
The JAX version adds the optional ``size`` argument which must be ... | union1d | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def setxor1d(ar1: ArrayLike, ar2: ArrayLike, assume_unique: bool = False, *,
size: int | None = None, fill_value: ArrayLike | None = None) -> Array:
"""Compute the set-wise xor of elements in two arrays.
JAX implementation of :func:`numpy.setxor1d`.
Because the size of the output of ``setxor1d`` is... | Compute the set-wise xor of elements in two arrays.
JAX implementation of :func:`numpy.setxor1d`.
Because the size of the output of ``setxor1d`` is data-dependent, the function is not
compatible with JIT or other JAX transformations.
Args:
ar1: first array of values to intersect.
ar2: second array of... | setxor1d | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def _intersect1d_size(arr1: Array, arr2: Array, fill_value: ArrayLike | None, assume_unique: bool,
size: int, return_indices: bool) -> Array | tuple[Array, Array, Array]:
"""Jit-compatible helper function for intersect1d with size specified."""
# Ensured by caller
assert arr1.ndim == arr2.nd... | Jit-compatible helper function for intersect1d with size specified. | _intersect1d_size | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def intersect1d(ar1: ArrayLike, ar2: ArrayLike, assume_unique: bool = False,
return_indices: bool = False, *, size: int | None = None,
fill_value: ArrayLike | None = None) -> Array | tuple[Array, Array, Array]:
"""Compute the set intersection of two 1D arrays.
JAX implementation of ... | Compute the set intersection of two 1D arrays.
JAX implementation of :func:`numpy.intersect1d`.
Because the size of the output of ``intersect1d`` is data-dependent, the function
is not typically compatible with :func:`~jax.jit` and other JAX transformations.
The JAX version adds the optional ``size`` argument... | intersect1d | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def isin(element: ArrayLike, test_elements: ArrayLike,
assume_unique: bool = False, invert: bool = False, *,
method='auto') -> Array:
"""Determine whether elements in ``element`` appear in ``test_elements``.
JAX implementation of :func:`numpy.isin`.
Args:
element: input array of elements f... | Determine whether elements in ``element`` appear in ``test_elements``.
JAX implementation of :func:`numpy.isin`.
Args:
element: input array of elements for which membership will be checked.
test_elements: N-dimensional array of test values to check for the presence of
each element.
invert: If Tr... | isin | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def _unique(ar: Array, axis: int, return_index: bool = False, return_inverse: bool = False,
return_counts: bool = False, equal_nan: bool = True, size: int | None = None,
fill_value: ArrayLike | None = None, return_true_size: bool = False
) -> Array | tuple[Array, ...]:
"""
Find t... |
Find the unique elements of an array along a particular axis.
| _unique | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def unique(ar: ArrayLike, return_index: bool = False, return_inverse: bool = False,
return_counts: bool = False, axis: int | None = None,
*, equal_nan: bool = True, size: int | None = None, fill_value: ArrayLike | None = None,
sorted: bool = True):
"""Return the unique values from an ... | Return the unique values from an array.
JAX implementation of :func:`numpy.unique`.
Because the size of the output of ``unique`` is data-dependent, the function
is not typically compatible with :func:`~jax.jit` and other JAX transformations.
The JAX version adds the optional ``size`` argument which must be sp... | unique | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def unique_all(x: ArrayLike, /, *, size: int | None = None,
fill_value: ArrayLike | None = None) -> _UniqueAllResult:
"""Return unique values from x, along with indices, inverse indices, and counts.
JAX implementation of :func:`numpy.unique_all`; this is equivalent to calling
:func:`jax.numpy.uniq... | Return unique values from x, along with indices, inverse indices, and counts.
JAX implementation of :func:`numpy.unique_all`; this is equivalent to calling
:func:`jax.numpy.unique` with `return_index`, `return_inverse`, `return_counts`,
and `equal_nan` set to True.
Because the size of the output of ``unique_a... | unique_all | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def unique_counts(x: ArrayLike, /, *, size: int | None = None,
fill_value: ArrayLike | None = None) -> _UniqueCountsResult:
"""Return unique values from x, along with counts.
JAX implementation of :func:`numpy.unique_counts`; this is equivalent to calling
:func:`jax.numpy.unique` with `return_c... | Return unique values from x, along with counts.
JAX implementation of :func:`numpy.unique_counts`; this is equivalent to calling
:func:`jax.numpy.unique` with `return_counts` and `equal_nan` set to True.
Because the size of the output of ``unique_counts`` is data-dependent, the function
is not typically compa... | unique_counts | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def unique_inverse(x: ArrayLike, /, *, size: int | None = None,
fill_value: ArrayLike | None = None) -> _UniqueInverseResult:
"""Return unique values from x, along with indices, inverse indices, and counts.
JAX implementation of :func:`numpy.unique_inverse`; this is equivalent to calling
:func... | Return unique values from x, along with indices, inverse indices, and counts.
JAX implementation of :func:`numpy.unique_inverse`; this is equivalent to calling
:func:`jax.numpy.unique` with `return_inverse` and `equal_nan` set to True.
Because the size of the output of ``unique_inverse`` is data-dependent, the ... | unique_inverse | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def unique_values(x: ArrayLike, /, *, size: int | None = None,
fill_value: ArrayLike | None = None) -> Array:
"""Return unique values from x, along with indices, inverse indices, and counts.
JAX implementation of :func:`numpy.unique_values`; this is equivalent to calling
:func:`jax.numpy.unique... | Return unique values from x, along with indices, inverse indices, and counts.
JAX implementation of :func:`numpy.unique_values`; this is equivalent to calling
:func:`jax.numpy.unique` with `equal_nan` set to True.
Because the size of the output of ``unique_values`` is data-dependent, the function
is not typic... | unique_values | python | jax-ml/jax | jax/_src/numpy/setops.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/setops.py | Apache-2.0 |
def sort(
a: ArrayLike,
axis: int | None = -1,
*,
kind: None = None,
order: None = None,
stable: bool = True,
descending: bool = False,
) -> Array:
"""Return a sorted copy of an array.
JAX implementation of :func:`numpy.sort`.
Args:
a: array to sort
axis: integer axis along w... | Return a sorted copy of an array.
JAX implementation of :func:`numpy.sort`.
Args:
a: array to sort
axis: integer axis along which to sort. Defaults to ``-1``, i.e. the last
axis. If ``None``, then ``a`` is flattened before being sorted.
stable: boolean specifying whether a stable sort should be ... | sort | python | jax-ml/jax | jax/_src/numpy/sorting.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/sorting.py | Apache-2.0 |
def argsort(
a: ArrayLike,
axis: int | None = -1,
*,
kind: None = None,
order: None = None,
stable: bool = True,
descending: bool = False,
) -> Array:
"""Return indices that sort an array.
JAX implementation of :func:`numpy.argsort`.
Args:
a: array to sort
axis: integer axis ... | Return indices that sort an array.
JAX implementation of :func:`numpy.argsort`.
Args:
a: array to sort
axis: integer axis along which to sort. Defaults to ``-1``, i.e. the last
axis. If ``None``, then ``a`` is flattened before being sorted.
stable: boolean specifying whether a stable sort should... | argsort | python | jax-ml/jax | jax/_src/numpy/sorting.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/sorting.py | Apache-2.0 |
def partition(a: ArrayLike, kth: int, axis: int = -1) -> Array:
"""Returns a partially-sorted copy of an array.
JAX implementation of :func:`numpy.partition`. The JAX version differs from
NumPy in the treatment of NaN entries: NaNs which have the negative bit set
are sorted to the beginning of the array.
Ar... | Returns a partially-sorted copy of an array.
JAX implementation of :func:`numpy.partition`. The JAX version differs from
NumPy in the treatment of NaN entries: NaNs which have the negative bit set
are sorted to the beginning of the array.
Args:
a: array to be partitioned.
kth: static integer index abo... | partition | python | jax-ml/jax | jax/_src/numpy/sorting.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/sorting.py | Apache-2.0 |
def argpartition(a: ArrayLike, kth: int, axis: int = -1) -> Array:
"""Returns indices that partially sort an array.
JAX implementation of :func:`numpy.argpartition`. The JAX version differs from
NumPy in the treatment of NaN entries: NaNs which have the negative bit set are
sorted to the beginning of the array... | Returns indices that partially sort an array.
JAX implementation of :func:`numpy.argpartition`. The JAX version differs from
NumPy in the treatment of NaN entries: NaNs which have the negative bit set are
sorted to the beginning of the array.
Args:
a: array to be partitioned.
kth: static integer index... | argpartition | python | jax-ml/jax | jax/_src/numpy/sorting.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/sorting.py | Apache-2.0 |
def sort_complex(a: ArrayLike) -> Array:
"""Return a sorted copy of complex array.
JAX implementation of :func:`numpy.sort_complex`.
Complex numbers are sorted lexicographically, meaning by their real part
first, and then by their imaginary part if real parts are equal.
Args:
a: input array. If dtype i... | Return a sorted copy of complex array.
JAX implementation of :func:`numpy.sort_complex`.
Complex numbers are sorted lexicographically, meaning by their real part
first, and then by their imaginary part if real parts are equal.
Args:
a: input array. If dtype is not complex, the array will be upcast to com... | sort_complex | python | jax-ml/jax | jax/_src/numpy/sorting.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/sorting.py | Apache-2.0 |
def lexsort(keys: Array | np.ndarray | Sequence[ArrayLike], axis: int = -1) -> Array:
"""Sort a sequence of keys in lexicographic order.
JAX implementation of :func:`numpy.lexsort`.
Args:
keys: a sequence of arrays to sort; all arrays must have the same shape.
The last key in the sequence is used as t... | Sort a sequence of keys in lexicographic order.
JAX implementation of :func:`numpy.lexsort`.
Args:
keys: a sequence of arrays to sort; all arrays must have the same shape.
The last key in the sequence is used as the primary key.
axis: the axis along which to sort (default: -1).
Returns:
An ar... | lexsort | python | jax-ml/jax | jax/_src/numpy/sorting.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/sorting.py | Apache-2.0 |
def dot(a: ArrayLike, b: ArrayLike, *,
precision: PrecisionLike = None,
preferred_element_type: DTypeLike | None = None,
out_sharding=None) -> Array:
"""Compute the dot product of two arrays.
JAX implementation of :func:`numpy.dot`.
This differs from :func:`jax.numpy.matmul` in two respe... | Compute the dot product of two arrays.
JAX implementation of :func:`numpy.dot`.
This differs from :func:`jax.numpy.matmul` in two respects:
- if either ``a`` or ``b`` is a scalar, the result of ``dot`` is equivalent to
:func:`jax.numpy.multiply`, while the result of ``matmul`` is an error.
- if ``a`` and... | dot | python | jax-ml/jax | jax/_src/numpy/tensor_contractions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/tensor_contractions.py | Apache-2.0 |
def matmul(a: ArrayLike, b: ArrayLike, *,
precision: PrecisionLike = None,
preferred_element_type: DTypeLike | None = None,
) -> Array:
"""Perform a matrix multiplication.
JAX implementation of :func:`numpy.matmul`.
Args:
a: first input array, of shape ``(N,)`` or ``(..., K,... | Perform a matrix multiplication.
JAX implementation of :func:`numpy.matmul`.
Args:
a: first input array, of shape ``(N,)`` or ``(..., K, N)``.
b: second input array. Must have shape ``(N,)`` or ``(..., N, M)``.
In the multi-dimensional case, leading dimensions must be broadcast-compatible
with... | matmul | python | jax-ml/jax | jax/_src/numpy/tensor_contractions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/tensor_contractions.py | Apache-2.0 |
def matvec(x1: ArrayLike, x2: ArrayLike, /) -> Array:
"""Batched matrix-vector product.
JAX implementation of :func:`numpy.matvec`.
Args:
x1: array of shape ``(..., M, N)``
x2: array of shape ``(..., N)``. Leading dimensions must be broadcast-compatible
with leading dimensions of ``x1``.
Return... | Batched matrix-vector product.
JAX implementation of :func:`numpy.matvec`.
Args:
x1: array of shape ``(..., M, N)``
x2: array of shape ``(..., N)``. Leading dimensions must be broadcast-compatible
with leading dimensions of ``x1``.
Returns:
An array of shape ``(..., M)`` containing the batche... | matvec | python | jax-ml/jax | jax/_src/numpy/tensor_contractions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/tensor_contractions.py | Apache-2.0 |
def vecmat(x1: ArrayLike, x2: ArrayLike, /) -> Array:
"""Batched conjugate vector-matrix product.
JAX implementation of :func:`numpy.vecmat`.
Args:
x1: array of shape ``(..., M)``.
x2: array of shape ``(..., M, N)``. Leading dimensions must be broadcast-compatible
with leading dimensions of ``x1``... | Batched conjugate vector-matrix product.
JAX implementation of :func:`numpy.vecmat`.
Args:
x1: array of shape ``(..., M)``.
x2: array of shape ``(..., M, N)``. Leading dimensions must be broadcast-compatible
with leading dimensions of ``x1``.
Returns:
An array of shape ``(..., N)`` containing... | vecmat | python | jax-ml/jax | jax/_src/numpy/tensor_contractions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/tensor_contractions.py | Apache-2.0 |
def vdot(
a: ArrayLike, b: ArrayLike, *,
precision: PrecisionLike = None,
preferred_element_type: DTypeLike | None = None,
) -> Array:
"""Perform a conjugate multiplication of two 1D vectors.
JAX implementation of :func:`numpy.vdot`.
Args:
a: first input array, if not 1D it will be flattened.
... | Perform a conjugate multiplication of two 1D vectors.
JAX implementation of :func:`numpy.vdot`.
Args:
a: first input array, if not 1D it will be flattened.
b: second input array, if not 1D it will be flattened. Must have ``a.size == b.size``.
precision: either ``None`` (default), which means the defau... | vdot | python | jax-ml/jax | jax/_src/numpy/tensor_contractions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/tensor_contractions.py | Apache-2.0 |
def vecdot(x1: ArrayLike, x2: ArrayLike, /, *, axis: int = -1,
precision: PrecisionLike = None,
preferred_element_type: DTypeLike | None = None) -> Array:
"""Perform a conjugate multiplication of two batched vectors.
JAX implementation of :func:`numpy.vecdot`.
Args:
a: left-hand side a... | Perform a conjugate multiplication of two batched vectors.
JAX implementation of :func:`numpy.vecdot`.
Args:
a: left-hand side array.
b: right-hand side array. Size of ``b[axis]`` must match size of ``a[axis]``,
and remaining dimensions must be broadcast-compatible.
axis: axis along which to com... | vecdot | python | jax-ml/jax | jax/_src/numpy/tensor_contractions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/tensor_contractions.py | Apache-2.0 |
def tensordot(a: ArrayLike, b: ArrayLike,
axes: int | Sequence[int] | Sequence[Sequence[int]] = 2,
*, precision: PrecisionLike = None,
preferred_element_type: DTypeLike | None = None) -> Array:
"""Compute the tensor dot product of two N-dimensional arrays.
JAX implementati... | Compute the tensor dot product of two N-dimensional arrays.
JAX implementation of :func:`numpy.linalg.tensordot`.
Args:
a: N-dimensional array
b: M-dimensional array
axes: integer or tuple of sequences of integers. If an integer `k`, then
sum over the last `k` axes of ``a`` and the first `k` axe... | tensordot | python | jax-ml/jax | jax/_src/numpy/tensor_contractions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/tensor_contractions.py | Apache-2.0 |
def inner(
a: ArrayLike, b: ArrayLike, *, precision: PrecisionLike = None,
preferred_element_type: DTypeLike | None = None,
) -> Array:
"""Compute the inner product of two arrays.
JAX implementation of :func:`numpy.inner`.
Unlike :func:`jax.numpy.matmul` or :func:`jax.numpy.dot`, this always performs
... | Compute the inner product of two arrays.
JAX implementation of :func:`numpy.inner`.
Unlike :func:`jax.numpy.matmul` or :func:`jax.numpy.dot`, this always performs
a contraction along the last dimension of each input.
Args:
a: array of shape ``(..., N)``
b: array of shape ``(..., N)``
precision: e... | inner | python | jax-ml/jax | jax/_src/numpy/tensor_contractions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/tensor_contractions.py | Apache-2.0 |
def outer(a: ArrayLike, b: ArrayLike, out: None = None) -> Array:
"""Compute the outer product of two arrays.
JAX implementation of :func:`numpy.outer`.
Args:
a: first input array, if not 1D it will be flattened.
b: second input array, if not 1D it will be flattened.
out: unsupported by JAX.
Retu... | Compute the outer product of two arrays.
JAX implementation of :func:`numpy.outer`.
Args:
a: first input array, if not 1D it will be flattened.
b: second input array, if not 1D it will be flattened.
out: unsupported by JAX.
Returns:
The outer product of the inputs ``a`` and ``b``. Returned arra... | outer | python | jax-ml/jax | jax/_src/numpy/tensor_contractions.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/tensor_contractions.py | Apache-2.0 |
def unary_ufunc(func: Callable[[ArrayLike], Array]) -> ufunc:
"""An internal helper function for defining unary ufuncs."""
func_jit = jit(func, inline=True)
return ufunc(func_jit, name=func.__name__, nin=1, nout=1, call=func_jit) | An internal helper function for defining unary ufuncs. | unary_ufunc | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def binary_ufunc(identity: Any, reduce: Callable[..., Any] | None = None,
accumulate: Callable[..., Any] | None = None,
at: Callable[..., Any] | None = None,
reduceat: Callable[..., Any] | None = None) -> Callable[[Callable[[ArrayLike, ArrayLike], Array]], ufunc]:
""... | An internal helper function for defining binary ufuncs. | binary_ufunc | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def fabs(x: ArrayLike, /) -> Array:
"""Compute the element-wise absolute values of the real-valued input.
JAX implementation of :obj:`numpy.fabs`.
Args:
x: input array or scalar. Must not have a complex dtype.
Returns:
An array with same shape as ``x`` and dtype float, containing the element-wise
... | Compute the element-wise absolute values of the real-valued input.
JAX implementation of :obj:`numpy.fabs`.
Args:
x: input array or scalar. Must not have a complex dtype.
Returns:
An array with same shape as ``x`` and dtype float, containing the element-wise
absolute values.
See also:
- :fun... | fabs | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def floor(x: ArrayLike, /) -> Array:
"""Round input to the nearest integer downwards.
JAX implementation of :obj:`numpy.floor`.
Args:
x: input array or scalar. Must not have complex dtype.
Returns:
An array with same shape and dtype as ``x`` containing the values rounded to
the nearest integer th... | Round input to the nearest integer downwards.
JAX implementation of :obj:`numpy.floor`.
Args:
x: input array or scalar. Must not have complex dtype.
Returns:
An array with same shape and dtype as ``x`` containing the values rounded to
the nearest integer that is less than or equal to the value itse... | floor | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def ceil(x: ArrayLike, /) -> Array:
"""Round input to the nearest integer upwards.
JAX implementation of :obj:`numpy.ceil`.
Args:
x: input array or scalar. Must not have complex dtype.
Returns:
An array with same shape and dtype as ``x`` containing the values rounded to
the nearest integer that i... | Round input to the nearest integer upwards.
JAX implementation of :obj:`numpy.ceil`.
Args:
x: input array or scalar. Must not have complex dtype.
Returns:
An array with same shape and dtype as ``x`` containing the values rounded to
the nearest integer that is greater than or equal to the value itse... | ceil | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def log(x: ArrayLike, /) -> Array:
"""Calculate element-wise natural logarithm of the input.
JAX implementation of :obj:`numpy.log`.
Args:
x: input array or scalar.
Returns:
An array containing the logarithm of each element in ``x``, promotes to inexact
dtype.
See also:
- :func:`jax.numpy.... | Calculate element-wise natural logarithm of the input.
JAX implementation of :obj:`numpy.log`.
Args:
x: input array or scalar.
Returns:
An array containing the logarithm of each element in ``x``, promotes to inexact
dtype.
See also:
- :func:`jax.numpy.exp`: Calculates element-wise exponentia... | log | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def log1p(x: ArrayLike, /) -> Array:
"""Calculates element-wise logarithm of one plus input, ``log(x+1)``.
JAX implementation of :obj:`numpy.log1p`.
Args:
x: input array or scalar.
Returns:
An array containing the logarithm of one plus of each element in ``x``,
promotes to inexact dtype.
Note:... | Calculates element-wise logarithm of one plus input, ``log(x+1)``.
JAX implementation of :obj:`numpy.log1p`.
Args:
x: input array or scalar.
Returns:
An array containing the logarithm of one plus of each element in ``x``,
promotes to inexact dtype.
Note:
``jnp.log1p`` is more accurate than w... | log1p | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def sin(x: ArrayLike, /) -> Array:
"""Compute a trigonometric sine of each element of input.
JAX implementation of :obj:`numpy.sin`.
Args:
x: array or scalar. Angle in radians.
Returns:
An array containing the sine of each element in ``x``, promotes to inexact
dtype.
See also:
- :func:`jax... | Compute a trigonometric sine of each element of input.
JAX implementation of :obj:`numpy.sin`.
Args:
x: array or scalar. Angle in radians.
Returns:
An array containing the sine of each element in ``x``, promotes to inexact
dtype.
See also:
- :func:`jax.numpy.cos`: Computes a trigonometric co... | sin | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def cos(x: ArrayLike, /) -> Array:
"""Compute a trigonometric cosine of each element of input.
JAX implementation of :obj:`numpy.cos`.
Args:
x: scalar or array. Angle in radians.
Returns:
An array containing the cosine of each element in ``x``, promotes to inexact
dtype.
See also:
- :func:... | Compute a trigonometric cosine of each element of input.
JAX implementation of :obj:`numpy.cos`.
Args:
x: scalar or array. Angle in radians.
Returns:
An array containing the cosine of each element in ``x``, promotes to inexact
dtype.
See also:
- :func:`jax.numpy.sin`: Computes a trigonometri... | cos | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def tan(x: ArrayLike, /) -> Array:
"""Compute a trigonometric tangent of each element of input.
JAX implementation of :obj:`numpy.tan`.
Args:
x: scalar or array. Angle in radians.
Returns:
An array containing the tangent of each element in ``x``, promotes to inexact
dtype.
See also:
- :fun... | Compute a trigonometric tangent of each element of input.
JAX implementation of :obj:`numpy.tan`.
Args:
x: scalar or array. Angle in radians.
Returns:
An array containing the tangent of each element in ``x``, promotes to inexact
dtype.
See also:
- :func:`jax.numpy.sin`: Computes a trigonomet... | tan | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def arcsin(x: ArrayLike, /) -> Array:
r"""Compute element-wise inverse of trigonometric sine of input.
JAX implementation of :obj:`numpy.arcsin`.
Args:
x: input array or scalar.
Returns:
An array containing the inverse trigonometric sine of each element of ``x``
in radians in the range ``[-pi/2, ... | Compute element-wise inverse of trigonometric sine of input.
JAX implementation of :obj:`numpy.arcsin`.
Args:
x: input array or scalar.
Returns:
An array containing the inverse trigonometric sine of each element of ``x``
in radians in the range ``[-pi/2, pi/2]``, promoting to inexact dtype.
Note... | arcsin | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def arccos(x: ArrayLike, /) -> Array:
"""Compute element-wise inverse of trigonometric cosine of input.
JAX implementation of :obj:`numpy.arccos`.
Args:
x: input array or scalar.
Returns:
An array containing the inverse trigonometric cosine of each element of ``x``
in radians in the range ``[0, p... | Compute element-wise inverse of trigonometric cosine of input.
JAX implementation of :obj:`numpy.arccos`.
Args:
x: input array or scalar.
Returns:
An array containing the inverse trigonometric cosine of each element of ``x``
in radians in the range ``[0, pi]``, promoting to inexact dtype.
Note:
... | arccos | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def arccosh(x: ArrayLike, /) -> Array:
r"""Calculate element-wise inverse of hyperbolic cosine of input.
JAX implementation of :obj:`numpy.arccosh`.
The inverse of hyperbolic cosine is defined by:
.. math::
arccosh(x) = \ln(x + \sqrt{x^2 - 1})
Args:
x: input array or scalar.
Returns:
An ar... | Calculate element-wise inverse of hyperbolic cosine of input.
JAX implementation of :obj:`numpy.arccosh`.
The inverse of hyperbolic cosine is defined by:
.. math::
arccosh(x) = \ln(x + \sqrt{x^2 - 1})
Args:
x: input array or scalar.
Returns:
An array of same shape as ``x`` containing the inv... | arccosh | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def arctanh(x: ArrayLike, /) -> Array:
r"""Calculate element-wise inverse of hyperbolic tangent of input.
JAX implementation of :obj:`numpy.arctanh`.
The inverse of hyperbolic tangent is defined by:
.. math::
arctanh(x) = \frac{1}{2} [\ln(1 + x) - \ln(1 - x)]
Args:
x: input array or scalar.
Re... | Calculate element-wise inverse of hyperbolic tangent of input.
JAX implementation of :obj:`numpy.arctanh`.
The inverse of hyperbolic tangent is defined by:
.. math::
arctanh(x) = \frac{1}{2} [\ln(1 + x) - \ln(1 - x)]
Args:
x: input array or scalar.
Returns:
An array of same shape as ``x`` co... | arctanh | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def sqrt(x: ArrayLike, /) -> Array:
"""Calculates element-wise non-negative square root of the input array.
JAX implementation of :obj:`numpy.sqrt`.
Args:
x: input array or scalar.
Returns:
An array containing the non-negative square root of the elements of ``x``.
Note:
- For real-valued negat... | Calculates element-wise non-negative square root of the input array.
JAX implementation of :obj:`numpy.sqrt`.
Args:
x: input array or scalar.
Returns:
An array containing the non-negative square root of the elements of ``x``.
Note:
- For real-valued negative inputs, ``jnp.sqrt`` produces a ``nan... | sqrt | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def add(x: ArrayLike, y: ArrayLike, /) -> Array:
"""Add two arrays element-wise.
JAX implementation of :obj:`numpy.add`. This is a universal function,
and supports the additional APIs described at :class:`jax.numpy.ufunc`.
This function provides the implementation of the ``+`` operator for
JAX arrays.
Arg... | Add two arrays element-wise.
JAX implementation of :obj:`numpy.add`. This is a universal function,
and supports the additional APIs described at :class:`jax.numpy.ufunc`.
This function provides the implementation of the ``+`` operator for
JAX arrays.
Args:
x, y: arrays to add. Must be broadcastable to a... | add | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def multiply(x: ArrayLike, y: ArrayLike, /) -> Array:
"""Multiply two arrays element-wise.
JAX implementation of :obj:`numpy.multiply`. This is a universal function,
and supports the additional APIs described at :class:`jax.numpy.ufunc`.
This function provides the implementation of the ``*`` operator for
JAX... | Multiply two arrays element-wise.
JAX implementation of :obj:`numpy.multiply`. This is a universal function,
and supports the additional APIs described at :class:`jax.numpy.ufunc`.
This function provides the implementation of the ``*`` operator for
JAX arrays.
Args:
x, y: arrays to multiply. Must be bro... | multiply | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def subtract(x: ArrayLike, y: ArrayLike, /) -> Array:
"""Subtract two arrays element-wise.
JAX implementation of :obj:`numpy.subtract`. This is a universal function,
and supports the additional APIs described at :class:`jax.numpy.ufunc`.
This function provides the implementation of the ``-`` operator for
JAX... | Subtract two arrays element-wise.
JAX implementation of :obj:`numpy.subtract`. This is a universal function,
and supports the additional APIs described at :class:`jax.numpy.ufunc`.
This function provides the implementation of the ``-`` operator for
JAX arrays.
Args:
x, y: arrays to subtract. Must be bro... | subtract | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def float_power(x: ArrayLike, y: ArrayLike, /) -> Array:
"""Calculate element-wise base ``x`` exponential of ``y``.
JAX implementation of :obj:`numpy.float_power`.
Args:
x: scalar or array. Specifies the bases.
y: scalar or array. Specifies the exponents. ``x`` and ``y`` should either
have same sh... | Calculate element-wise base ``x`` exponential of ``y``.
JAX implementation of :obj:`numpy.float_power`.
Args:
x: scalar or array. Specifies the bases.
y: scalar or array. Specifies the exponents. ``x`` and ``y`` should either
have same shape or be broadcast compatible.
Returns:
An array conta... | float_power | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def spacing(x: ArrayLike, /) -> Array:
"""Return the spacing between ``x`` and the next adjacent number.
JAX implementation of :func:`numpy.spacing`.
Args:
x: real-valued array. Integer or boolean types will be cast to float.
Returns:
Array of same shape as ``x`` containing spacing between each entry... | Return the spacing between ``x`` and the next adjacent number.
JAX implementation of :func:`numpy.spacing`.
Args:
x: real-valued array. Integer or boolean types will be cast to float.
Returns:
Array of same shape as ``x`` containing spacing between each entry of
``x`` and its closest adjacent value... | spacing | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def bitwise_count(x: ArrayLike, /) -> Array:
r"""Counts the number of 1 bits in the binary representation of the absolute value
of each element of ``x``.
JAX implementation of :obj:`numpy.bitwise_count`.
Args:
x: Input array, only accepts integer subtypes
Returns:
An array-like object containing th... | Counts the number of 1 bits in the binary representation of the absolute value
of each element of ``x``.
JAX implementation of :obj:`numpy.bitwise_count`.
Args:
x: Input array, only accepts integer subtypes
Returns:
An array-like object containing the binary 1 bit counts of the absolute value of
... | bitwise_count | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def right_shift(x1: ArrayLike, x2: ArrayLike, /) -> Array:
r"""Right shift the bits of ``x1`` to the amount specified in ``x2``.
JAX implementation of :obj:`numpy.right_shift`.
Args:
x1: Input array, only accepts unsigned integer subtypes
x2: The amount of bits to shift each element in ``x1`` to the rig... | Right shift the bits of ``x1`` to the amount specified in ``x2``.
JAX implementation of :obj:`numpy.right_shift`.
Args:
x1: Input array, only accepts unsigned integer subtypes
x2: The amount of bits to shift each element in ``x1`` to the right, only accepts
integer subtypes
Returns:
An array-... | right_shift | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def absolute(x: ArrayLike, /) -> Array:
r"""Calculate the absolute value element-wise.
JAX implementation of :obj:`numpy.absolute`.
This is the same function as :func:`jax.numpy.abs`.
Args:
x: Input array
Returns:
An array-like object containing the absolute value of each element in ``x``,
wit... | Calculate the absolute value element-wise.
JAX implementation of :obj:`numpy.absolute`.
This is the same function as :func:`jax.numpy.abs`.
Args:
x: Input array
Returns:
An array-like object containing the absolute value of each element in ``x``,
with the same shape as ``x``. For complex valued ... | absolute | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def rint(x: ArrayLike, /) -> Array:
"""Rounds the elements of x to the nearest integer
JAX implementation of :obj:`numpy.rint`.
Args:
x: Input array
Returns:
An array-like object containing the rounded elements of ``x``. Always promotes
to inexact.
Note:
If an element of x is exactly half ... | Rounds the elements of x to the nearest integer
JAX implementation of :obj:`numpy.rint`.
Args:
x: Input array
Returns:
An array-like object containing the rounded elements of ``x``. Always promotes
to inexact.
Note:
If an element of x is exactly half way, e.g. ``0.5`` or ``1.5``, rint will r... | rint | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def copysign(x1: ArrayLike, x2: ArrayLike, /) -> Array:
"""Copies the sign of each element in ``x2`` to the corresponding element in ``x1``.
JAX implementation of :obj:`numpy.copysign`.
Args:
x1: Input array
x2: The array whose elements will be used to determine the sign, must be
broadcast-compati... | Copies the sign of each element in ``x2`` to the corresponding element in ``x1``.
JAX implementation of :obj:`numpy.copysign`.
Args:
x1: Input array
x2: The array whose elements will be used to determine the sign, must be
broadcast-compatible with ``x1``
Returns:
An array object containing th... | copysign | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def true_divide(x1: ArrayLike, x2: ArrayLike, /) -> Array:
"""Calculates the division of x1 by x2 element-wise
JAX implementation of :func:`numpy.true_divide`.
Args:
x1: Input array, the dividend
x2: Input array, the divisor
Returns:
An array containing the elementwise quotients, will always use
... | Calculates the division of x1 by x2 element-wise
JAX implementation of :func:`numpy.true_divide`.
Args:
x1: Input array, the dividend
x2: Input array, the divisor
Returns:
An array containing the elementwise quotients, will always use
floating point division.
Examples:
>>> x1 = jnp.array... | true_divide | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def floor_divide(x1: ArrayLike, x2: ArrayLike, /) -> Array:
"""Calculates the floor division of x1 by x2 element-wise
JAX implementation of :obj:`numpy.floor_divide`.
Args:
x1: Input array, the dividend
x2: Input array, the divisor
Returns:
An array-like object containing each of the quotients ro... | Calculates the floor division of x1 by x2 element-wise
JAX implementation of :obj:`numpy.floor_divide`.
Args:
x1: Input array, the dividend
x2: Input array, the divisor
Returns:
An array-like object containing each of the quotients rounded down
to the nearest integer towards negative infinity. ... | floor_divide | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def divmod(x1: ArrayLike, x2: ArrayLike, /) -> tuple[Array, Array]:
"""Calculates the integer quotient and remainder of x1 by x2 element-wise
JAX implementation of :obj:`numpy.divmod`.
Args:
x1: Input array, the dividend
x2: Input array, the divisor
Returns:
A tuple of arrays ``(x1 // x2, x1 % x2... | Calculates the integer quotient and remainder of x1 by x2 element-wise
JAX implementation of :obj:`numpy.divmod`.
Args:
x1: Input array, the dividend
x2: Input array, the divisor
Returns:
A tuple of arrays ``(x1 // x2, x1 % x2)``.
See Also:
- :func:`jax.numpy.floor_divide`: floor division fu... | divmod | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def power(x1: ArrayLike, x2: ArrayLike, /) -> Array:
"""Calculate element-wise base ``x1`` exponential of ``x2``.
JAX implementation of :obj:`numpy.power`.
Args:
x1: scalar or array. Specifies the bases.
x2: scalar or array. Specifies the exponent. ``x1`` and ``x2`` should either
have same shape o... | Calculate element-wise base ``x1`` exponential of ``x2``.
JAX implementation of :obj:`numpy.power`.
Args:
x1: scalar or array. Specifies the bases.
x2: scalar or array. Specifies the exponent. ``x1`` and ``x2`` should either
have same shape or be broadcast compatible.
Returns:
An array contai... | power | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def logaddexp(x1: ArrayLike, x2: ArrayLike, /) -> Array:
"""Compute ``log(exp(x1) + exp(x2))`` avoiding overflow.
JAX implementation of :obj:`numpy.logaddexp`
Args:
x1: input array
x2: input array
Returns:
array containing the result.
Examples:
>>> x1 = jnp.array([1, 2, 3])
>>> x2 = jnp.a... | Compute ``log(exp(x1) + exp(x2))`` avoiding overflow.
JAX implementation of :obj:`numpy.logaddexp`
Args:
x1: input array
x2: input array
Returns:
array containing the result.
Examples:
>>> x1 = jnp.array([1, 2, 3])
>>> x2 = jnp.array([4, 5, 6])
>>> result1 = jnp.logaddexp(x1, x2)
>>> re... | logaddexp | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def logaddexp2(x1: ArrayLike, x2: ArrayLike, /) -> Array:
"""Logarithm of the sum of exponentials of inputs in base-2 avoiding overflow.
JAX implementation of :obj:`numpy.logaddexp2`.
Args:
x1: input array or scalar.
x2: input array or scalar. ``x1`` and ``x2`` should either have same shape or
be ... | Logarithm of the sum of exponentials of inputs in base-2 avoiding overflow.
JAX implementation of :obj:`numpy.logaddexp2`.
Args:
x1: input array or scalar.
x2: input array or scalar. ``x1`` and ``x2`` should either have same shape or
be broadcast compatible.
Returns:
An array containing the r... | logaddexp2 | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def log2(x: ArrayLike, /) -> Array:
"""Calculates the base-2 logarithm of ``x`` element-wise.
JAX implementation of :obj:`numpy.log2`.
Args:
x: Input array
Returns:
An array containing the base-2 logarithm of each element in ``x``, promotes
to inexact dtype.
Examples:
>>> x1 = jnp.array([0... | Calculates the base-2 logarithm of ``x`` element-wise.
JAX implementation of :obj:`numpy.log2`.
Args:
x: Input array
Returns:
An array containing the base-2 logarithm of each element in ``x``, promotes
to inexact dtype.
Examples:
>>> x1 = jnp.array([0.25, 0.5, 1, 2, 4, 8])
>>> jnp.log2(x... | log2 | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def log10(x: ArrayLike, /) -> Array:
"""Calculates the base-10 logarithm of x element-wise
JAX implementation of :obj:`numpy.log10`.
Args:
x: Input array
Returns:
An array containing the base-10 logarithm of each element in ``x``, promotes
to inexact dtype.
Examples:
>>> x1 = jnp.array([0.... | Calculates the base-10 logarithm of x element-wise
JAX implementation of :obj:`numpy.log10`.
Args:
x: Input array
Returns:
An array containing the base-10 logarithm of each element in ``x``, promotes
to inexact dtype.
Examples:
>>> x1 = jnp.array([0.01, 0.1, 1, 10, 100, 1000])
>>> with j... | log10 | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def signbit(x: ArrayLike, /) -> Array:
"""Return the sign bit of array elements.
JAX implementation of :obj:`numpy.signbit`.
Args:
x: input array. Complex values are not supported.
Returns:
A boolean array of the same shape as ``x``, containing ``True``
where the sign of ``x`` is negative, and ``... | Return the sign bit of array elements.
JAX implementation of :obj:`numpy.signbit`.
Args:
x: input array. Complex values are not supported.
Returns:
A boolean array of the same shape as ``x``, containing ``True``
where the sign of ``x`` is negative, and ``False`` otherwise.
See also:
- :func:... | signbit | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
def ldexp(x1: ArrayLike, x2: ArrayLike, /) -> Array:
"""Compute x1 * 2 ** x2
JAX implementation of :func:`numpy.ldexp`.
Note that XLA does not provide an ``ldexp`` operation, so this
is implemneted in JAX via a standard multiplication and
exponentiation.
Args:
x1: real-valued input array.
x2: int... | Compute x1 * 2 ** x2
JAX implementation of :func:`numpy.ldexp`.
Note that XLA does not provide an ``ldexp`` operation, so this
is implemneted in JAX via a standard multiplication and
exponentiation.
Args:
x1: real-valued input array.
x2: integer input array. Must be broadcast-compatible with ``x1``... | ldexp | python | jax-ml/jax | jax/_src/numpy/ufuncs.py | https://github.com/jax-ml/jax/blob/master/jax/_src/numpy/ufuncs.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.