Calculate the absolute value element-wise.
JAX implementation of numpy.absolute
.
This is the same function as jax.numpy.abs()
.
x (ArrayLike) – Input array
An array-like object containing the absolute value of each element in x
, with the same shape as x
. For complex valued input, \(a + ib\), the absolute value is \(\sqrt{a^2+b^2}\).
Examples
>>> x1 = jnp.array([5, -2, 0, 12]) >>> jnp.absolute(x1) Array([ 5, 2, 0, 12], dtype=int32)
>>> x2 = jnp.array([[ 8, -3, 1],[ 0, 9, -6]]) >>> jnp.absolute(x2) Array([[8, 3, 1], [0, 9, 6]], dtype=int32)
>>> x3 = jnp.array([8 + 15j, 3 - 4j, -5 + 0j]) >>> jnp.absolute(x3) Array([17., 5., 5.], 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