Replace nan with zero and inf with large finite numbers.
If x is inexact, NaN is replaced by zero, and infinity and -infinity
replaced by the respectively largest and most negative finite floating
point values representable by x.dtype.
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 (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.
Shows which elements are positive or negative infinity.
Shows which elements are negative infinity.
Shows which elements are positive infinity.
Shows which elements are Not a Number (NaN).
Shows which elements are finite (not NaN, not infinity)
Mars uses the IEEE Standard for Binary Floating-Point for Arithmetic
(IEEE 754). This means that Not a Number is not equivalent to infinity.
>>> import mars.tensor as mt
>>> x = mt.array([mt.inf, -mt.inf, mt.nan, -128, 128])
array([ 1.79769313e+308, -1.79769313e+308, 0.00000000e+000,
>>> y = mt.array([complex(mt.inf, mt.nan), mt.nan, complex(mt.nan, mt.inf)])
array([ 1.79769313e+308 +0.00000000e+000j,