Round#
Domain:
ai.onnxSince version: 22
Round takes one input Tensor and rounds the values, element-wise, meaning it finds the nearest integer for each value. In case of halves, the rule is to round them to the nearest even integer. If input x is integral, +0, -0, NaN, or infinite, x itself is returned. The output tensor has the same shape and type as the input.
Examples:
round([0.9]) = [1.0]
round([2.5]) = [2.0]
round([2.3]) = [2.0]
round([1.5]) = [2.0]
round([-4.5]) = [-4.0]
Inputs
X (T): Input tensor
Outputs
Y (T): Output tensor
Type Constraints
T: Constrain input and output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16).
Examples#
test_cc_round
Node:
Round(x) -> (y)
Inputs:
x: shape=(2, 3), dtype=float32
[[ 0.9, 2.5, 2.3],
[ 1.5, -4.5, -2.5]]
Outputs:
y: shape=(2, 3), dtype=float32
[[ 1., 2., 2.],
[ 2., -4., -2.]]
test_round
Node:
Round(x) -> (y)
Inputs:
x: shape=(15,), dtype=float32
[ 0.1, 0.5, 0.9, 1.2, 1.5, 1.8, 2.3, 2.5, 2.7, -1.1, -1.5, -1.9, -2.2,
-2.5, -2.8]
Outputs:
y: shape=(15,), dtype=float32
[ 0., 0., 1., 1., 2., 2., 2., 2., 3., -1., -2., -2., -2., -2., -3.]
Differences with previous version (11)#
SchemaDiff: Round (domain 'ai.onnx')
old version: 11
new version: 22
breaking: no
Type constraints:
changed ‘T’: added types: [‘tensor(bfloat16)’]