Skip to content

Commit cc93f0e

Browse files
authored
Merge pull request #1173 from alexlyulkov:al/range-fixed-5.x
Added int tests for Range dnn layer
2 parents e5c1316 + 3caff74 commit cc93f0e

13 files changed

+104
-0
lines changed
144 Bytes
Binary file not shown.
Binary file not shown.
160 Bytes
Binary file not shown.
Binary file not shown.
144 Bytes
Binary file not shown.
Binary file not shown.
160 Bytes
Binary file not shown.
Binary file not shown.

testdata/dnn/onnx/generate_onnx_models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,6 +1954,14 @@ def create_range_test(name, np_dtype, onnx_dtype, start_val, end_val, step_val,
19541954
create_range_test("range_float", np.float32, onnx.TensorProto.FLOAT, 1.1, 8.5, 2.0, [[0, 0, 0, 0]], [[1.1, 3.1, 5.1, 7.1]])
19551955
create_range_test("range_float_negative", np.float32, onnx.TensorProto.FLOAT, 8.5, 0.6, -2.0, [[0, 0, 0, 0]], [[8.5, 6.5, 4.5, 2.5]])
19561956

1957+
t = 1000000000
1958+
create_range_test("range_int32", np.int32, onnx.TensorProto.INT32, t + 1, t + 9, 2, [[0, 0, 0, 0]], [[t + 1, t + 3, t + 5, t + 7]])
1959+
create_range_test("range_int32_negative", np.int32, onnx.TensorProto.INT32, t + 8, t + 1, -2, [[0, 0, 0, 0]], [[t + 8, t + 6, t + 4, t + 2]])
1960+
1961+
t = 1000000000000000000
1962+
create_range_test("range_int64", np.int64, onnx.TensorProto.INT64, t + 1, t + 8, 2, [[0, 0, 0, 0]], [[t + 1, t + 3, t + 5, t + 7]])
1963+
create_range_test("range_int64_negative", np.int64, onnx.TensorProto.INT64, t + 9, t + 1, -2, [[0, 0, 0, 0]], [[t + 9, t + 7, t + 5, t + 3]])
1964+
19571965
class Conv(nn.Module):
19581966
def forward(self, x, kernel):
19591967
out = F.conv2d(x, kernel, groups=1)

testdata/dnn/onnx/models/range_int32.onnx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+

2+
 model_range:�
3+
7start1node-c1"Constant*
4+
value**����Bc1v�
5+
5end1node-c2"Constant*
6+
value**����Bc2v�
7+
2step1node-c3"Constant*
8+
value*
9+
*Bc3v�
10+
4
11+
start1
12+
end1
13+
step1range_output1node-r1"Range
14+
2
15+
input1
16+
range_output1 add_output1node-a1"Addgraph123Z
17+
input1
18+

19+

20+
b
21+
add_output1
22+

23+

24+
B

0 commit comments

Comments
 (0)