jax.lax.sign#

jax.lax.sign(x)[source]#

Elementwise sign.

For floating-point inputs, returns \(\mathrm{sign}(x) = \begin{cases} -1 & x < 0\\ -0 & x = -0\\ \mathit{NaN} & x = \mathit{NaN}\\ +0 & x = +0\\ 1 & x > 0 \end{cases}\)

For signed integer inputs, returns \(\mathrm{sign}(x) = \begin{cases} -1 & x < 0\\ 0 & x = 0\\ 1 & x > 0 \end{cases}\)

For complex inputs, returns the complex phase, i.e. \(\mathrm{sign}(x) = \frac{x}{|x|}\).

Parameters

x (Union[Array, ndarray, bool_, number, bool, int, float, complex]) –

Return type

Array