Round

torch_round(self)

Arguments

self

(Tensor) the input tensor.

round(input, out=NULL) -> Tensor

Returns a new tensor with each of the elements of input rounded to the closest integer.

Examples

if (torch_is_installed()) { a = torch_randn(c(4)) a torch_round(a) }
#> torch_tensor #> 0 #> 1 #> 1 #> -1 #> [ CPUFloatType{4} ]