mars.tensor.fix¶
- mars.tensor.fix(x, out=None, **kwargs)[源代码]¶
Round to nearest integer towards zero.
Round a tensor of floats element-wise to nearest integer towards zero. The rounded values are returned as floats.
- 参数
x (array_like) – An tensor of floats to be rounded
out (Tensor, optional) – Output tensor
- 返回
out – The array of rounded numbers
- 返回类型
Tensor of floats
实际案例
>>> import mars.tensor as mt
>>> mt.fix(3.14).execute() 3.0 >>> mt.fix(3).execute() 3.0 >>> mt.fix([2.1, 2.9, -2.1, -2.9]).execute() array([ 2., 2., -2., -2.])