Comment on page
tensor.round
#tensor.round
fn round(self: @Tensor<T>) -> Tensor<T>;
Computes the round value of all elements in the input tensor.
self
(@Tensor<T>
) - The input tensor.
A new
Tensor<T>
of the same shape as the input tensor with the round value of all elements in the input tensor.use array::{ArrayTrait, SpanTrait};
use orion::operators::tensor::{TensorTrait, Tensor, FP16x16Tensor};
use orion::numbers::{FixedTrait, FP16x16};
fn round_example() -> Tensor<FP16x16> {
let tensor = TensorTrait::<FP16x16>::new(
shape: array![3].span(),
data: array![
FixedTrait::new(190054, false), // 2.9
]
.span(),
);
return tensor.round();
}
>>> [3]
Last modified 27d ago