Return the spacing between x
and the next adjacent number.
JAX implementation of numpy.spacing()
.
x (ArrayLike) – real-valued array. Integer or boolean types will be cast to float.
Array of same shape as x
containing spacing between each entry of x
and its closest adjacent value.
Examples
>>> x = jnp.array([0.0, 0.25, 0.5, 0.75, 1.0], dtype='float32') >>> jnp.spacing(x) Array([1.4012985e-45, 2.9802322e-08, 5.9604645e-08, 5.9604645e-08, 1.1920929e-07], dtype=float32)
For x = 1
, the spacing is equal to the eps
value given by jax.numpy.finfo
:
>>> x = jnp.float32(1) >>> jnp.spacing(x) == jnp.finfo(x.dtype).eps Array(True, dtype=bool)
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