- jax.numpy.nan_to_num(x, copy=True, nan=0.0, posinf=None, neginf=None)#
Replace NaN with zero and infinity with large finite numbers (default
LAX-backend implementation of
Original docstring below.
behaviour) or with the numbers defined by the user using the nan, posinf and/or neginf keywords.
If x is inexact, NaN is replaced by zero or by the user defined value in nan keyword, infinity is replaced by the largest finite floating point values representable by
x.dtypeor by the user defined value in posinf keyword and -infinity is replaced by the most negative finite floating point values representable by
x.dtypeor by the user defined value in neginf keyword.
For complex dtypes, the above is applied to each of the real and imaginary components of x separately.
If x is not inexact, then no replacements are made.
x (scalar or array_like) – Input data.
copy (bool, optional) – Whether to create a copy of x (True) or to replace values in-place (False). The in-place operation only occurs if casting to an array does not require a copy. Default is True.
out – x, with the non-finite values replaced. If copy is False, this may be x itself.
- Return type: