Compute the element-wise absolute values of the real-valued input.
JAX implementation of numpy.fabs
.
x (ArrayLike) – input array or scalar. Must not have a complex dtype.
An array with same shape as x
and dtype float, containing the element-wise absolute values.
See also
jax.numpy.absolute()
: Computes the absolute values of the input including complex dtypes.
jax.numpy.abs()
: Computes the absolute values of the input including complex dtypes.
Examples
For integer inputs:
>>> x = jnp.array([-5, -9, 1, 10, 15]) >>> jnp.fabs(x) Array([ 5., 9., 1., 10., 15.], dtype=float32)
For float type inputs:
>>> x1 = jnp.array([-1.342, 5.649, 3.927]) >>> jnp.fabs(x1) Array([1.342, 5.649, 3.927], dtype=float32)
For boolean inputs:
>>> x2 = jnp.array([True, False]) >>> jnp.fabs(x2) Array([1., 0.], dtype=float32)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4