Range - version 11#
This page documents version 11 of operator Range. See Range for the latest version (since version 27).
Domain:
ai.onnxSince version: 11
Generate a tensor containing a sequence of numbers that begin at start and extends by increments of delta
up to limit (exclusive).
The number of elements in the output of range is computed as below:
number_of_elements = max( ceil( (limit - start) / delta ) , 0 )
The pseudocode determining the contents of the output is shown below:
for(int i=0; i<number_of_elements; ++i) {
output[i] = start + (i * delta);
}
Example 1
Inputs: start = 3, limit = 9, delta = 3
Output: [3, 6]
Example 2
Inputs: start = 10, limit = 4, delta = -2
Output: [10, 8, 6]
Inputs
start (T): Scalar. First entry for the range of output values.
limit (T): Scalar. Exclusive upper limit for the range of output values.
delta (T): Scalar. Value to step by.
Outputs
output (T): A 1-D tensor with same type as the inputs containing generated range of values.
Type Constraints
T: Constrain input types to common numeric type tensors. Allowed types: tensor(double), tensor(float), tensor(int16), tensor(int32), tensor(int64).
Examples#
test_range_float_type_positive_delta
Node:
Range(start, limit, delta) -> (output)
Inputs:
start: shape=(), dtype=float32
1.
limit: shape=(), dtype=float32
5.
delta: shape=(), dtype=float32
2.
Outputs:
output: shape=(2,), dtype=float32
[1., 3.]
test_range_int32_type_negative_delta
Node:
Range(start, limit, delta) -> (output)
Inputs:
start: shape=(), dtype=int32
10
limit: shape=(), dtype=int32
6
delta: shape=(), dtype=int32
-3
Outputs:
output: shape=(2,), dtype=int32
[10, 7]