mars.tensor.spacing¶
- mars.tensor.spacing(x, out=None, where=None, **kwargs)[源代码]¶
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
提示
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 betweenx + spacing(x)
and x for any finite x.Spacing of +- inf and NaN is NaN.
实际案例
>>> import mars.tensor as mt
>>> (mt.spacing(1) == mt.finfo(mt.float64).eps).execute() True