oneflow.round

oneflow.round()

This operator rounds the value of Blob to the nearest integer. :param input: A Tensor :type input: oneflow.Tensor

Returns

The result Tensor

Return type

oneflow.Tensor

For example:

>>> import oneflow as flow
>>> import numpy as np
>>> x1 = flow.tensor(np.array([1.49999, 1.500001, 2.7]).astype(np.float32))
>>> out1 = flow.round(x1)
>>> out1.numpy()
array([1., 2., 3.], dtype=float32)
>>> x2 = flow.tensor(np.array([2.499999, 7.5000001, 5.3, 6.8]).astype(np.float32))
>>> out2 = flow.round(x2)
>>> out2.numpy()
array([2., 8., 5., 7.], dtype=float32)