torch.round¶
-
torch.
round
(input, *, out=None) → Tensor¶ Returns a new tensor with each of the elements of
input
rounded to the closest integer.- Parameters
input (Tensor) – the input tensor.
- Keyword Arguments
out (Tensor, optional) – the output tensor.
Example:
>>> a = torch.randn(4) >>> a tensor([ 0.9920, 0.6077, 0.9734, -1.0362]) >>> torch.round(a) tensor([ 1., 1., 1., -1.])