mars.tensor.
spacing
Return the distance between x and the nearest adjacent number.
x (array_like) – Values to find the spacing of.
out (Tensor, None, or tuple of Tensor and None, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated tensor is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
where (array_like, optional) – Values of True indicate to calculate the ufunc at that position, values of False indicate to leave the value in the output alone.
**kwargs –
out – The spacing of values of x1.
array_like
Notes
It can be considered as a generalization of EPS: spacing(mt.float64(1)) == mt.finfo(mt.float64).eps, and there should not be any representable number between x + spacing(x) and x for any finite x.
spacing(mt.float64(1)) == mt.finfo(mt.float64).eps
x + spacing(x)
Spacing of +- inf and NaN is NaN.
Examples
>>> import mars.tensor as mt
>>> (mt.spacing(1) == mt.finfo(mt.float64).eps).execute() True