Skip to content

Commit bcf38a2

Browse files
test qlinear concat
1 parent 659b964 commit bcf38a2

File tree

3 files changed

+350
-0
lines changed

3 files changed

+350
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
ir_version: 3
2+
producer_name: "OpenVINO ONNX Frontend"
3+
producer_version: ""
4+
model_version: 0
5+
graph {
6+
name: "test_qlinear_concat_i8"
7+
8+
node {
9+
input: "Y_scale"
10+
input: "Y_zero_point"
11+
input: "X1"
12+
input: "X1_scale"
13+
input: "X1_zero_point"
14+
input: "X2"
15+
input: "X2_scale"
16+
input: "X2_zero_point"
17+
output: "Y"
18+
op_type: "QLinearConcat"
19+
attribute {
20+
name: "axis"
21+
i: 1
22+
type: INT
23+
}
24+
domain: "com.microsoft"
25+
}
26+
27+
input {
28+
name: "Y_scale"
29+
type {
30+
tensor_type {
31+
elem_type: 1
32+
shape {
33+
dim { dim_value: 1 }
34+
}
35+
}
36+
}
37+
}
38+
39+
input {
40+
name: "Y_zero_point"
41+
type {
42+
tensor_type {
43+
elem_type: 3
44+
shape {
45+
dim { dim_value: 1 }
46+
}
47+
}
48+
}
49+
}
50+
51+
input {
52+
name: "X1"
53+
type {
54+
tensor_type {
55+
elem_type: 3
56+
shape {
57+
dim { dim_value: 2 }
58+
dim { dim_value: 2 }
59+
}
60+
}
61+
}
62+
}
63+
64+
input {
65+
name: "X1_scale"
66+
type {
67+
tensor_type {
68+
elem_type: 1
69+
shape {
70+
dim { dim_value: 1 }
71+
}
72+
}
73+
}
74+
}
75+
76+
input {
77+
name: "X1_zero_point"
78+
type {
79+
tensor_type {
80+
elem_type: 3
81+
shape {
82+
dim { dim_value: 1 }
83+
}
84+
}
85+
}
86+
}
87+
88+
input {
89+
name: "X2"
90+
type {
91+
tensor_type {
92+
elem_type: 3
93+
shape {
94+
dim { dim_value: 2 }
95+
dim { dim_value: 2 }
96+
}
97+
}
98+
}
99+
}
100+
101+
input {
102+
name: "X2_scale"
103+
type {
104+
tensor_type {
105+
elem_type: 1
106+
shape {
107+
dim { dim_value: 1 }
108+
}
109+
}
110+
}
111+
}
112+
113+
input {
114+
name: "X2_zero_point"
115+
type {
116+
tensor_type {
117+
elem_type: 3
118+
shape {
119+
dim { dim_value: 1 }
120+
}
121+
}
122+
}
123+
}
124+
125+
output {
126+
name: "Y"
127+
type {
128+
tensor_type {
129+
elem_type: 3
130+
shape {
131+
dim { dim_value: 2 }
132+
dim { dim_value: 4 }
133+
}
134+
}
135+
}
136+
}
137+
}
138+
139+
opset_import {
140+
version: 1
141+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
ir_version: 3
2+
producer_name: "OpenVINO ONNX Frontend"
3+
producer_version: ""
4+
model_version: 0
5+
graph {
6+
name: "test_qlinear_concat_u8"
7+
8+
node {
9+
input: "Y_scale"
10+
input: "Y_zero_point"
11+
input: "X1"
12+
input: "X1_scale"
13+
input: "X1_zero_point"
14+
input: "X2"
15+
input: "X2_scale"
16+
input: "X2_zero_point"
17+
output: "Y"
18+
op_type: "QLinearConcat"
19+
attribute {
20+
name: "axis"
21+
i: 1
22+
type: INT
23+
}
24+
domain: "com.microsoft"
25+
}
26+
27+
input {
28+
name: "Y_scale"
29+
type {
30+
tensor_type {
31+
elem_type: 1
32+
shape {
33+
dim { dim_value: 1 }
34+
}
35+
}
36+
}
37+
}
38+
39+
input {
40+
name: "Y_zero_point"
41+
type {
42+
tensor_type {
43+
elem_type: 2
44+
shape {
45+
dim { dim_value: 1 }
46+
}
47+
}
48+
}
49+
}
50+
51+
input {
52+
name: "X1"
53+
type {
54+
tensor_type {
55+
elem_type: 2
56+
shape {
57+
dim { dim_value: 4 }
58+
dim { dim_value: 6 }
59+
}
60+
}
61+
}
62+
}
63+
64+
input {
65+
name: "X1_scale"
66+
type {
67+
tensor_type {
68+
elem_type: 1
69+
shape {
70+
dim { dim_value: 1 }
71+
}
72+
}
73+
}
74+
}
75+
76+
input {
77+
name: "X1_zero_point"
78+
type {
79+
tensor_type {
80+
elem_type: 2
81+
shape {
82+
dim { dim_value: 1 }
83+
}
84+
}
85+
}
86+
}
87+
88+
input {
89+
name: "X2"
90+
type {
91+
tensor_type {
92+
elem_type: 2
93+
shape {
94+
dim { dim_value: 4 }
95+
dim { dim_value: 6 }
96+
}
97+
}
98+
}
99+
}
100+
101+
input {
102+
name: "X2_scale"
103+
type {
104+
tensor_type {
105+
elem_type: 1
106+
shape {
107+
dim { dim_value: 1 }
108+
}
109+
}
110+
}
111+
}
112+
113+
input {
114+
name: "X2_zero_point"
115+
type {
116+
tensor_type {
117+
elem_type: 2
118+
shape {
119+
dim { dim_value: 1 }
120+
}
121+
}
122+
}
123+
}
124+
125+
output {
126+
name: "Y"
127+
type {
128+
tensor_type {
129+
elem_type: 2
130+
shape {
131+
dim { dim_value: 4 }
132+
dim { dim_value: 12 }
133+
}
134+
}
135+
}
136+
}
137+
}
138+
139+
opset_import {
140+
version: 1
141+
}

src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp

+68
Original file line numberDiff line numberDiff line change
@@ -1740,3 +1740,71 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_bias_add) {
17401740

17411741
test_case.run();
17421742
}
1743+
1744+
OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_qlinear_concat_i8) {
1745+
const auto model = convert_model("com.microsoft/qlinear_concat_i8.onnx");
1746+
auto test_case = ov::test::TestCase(model, s_device);
1747+
1748+
const std::vector<float> y_scale{0.1f};
1749+
const std::vector<int8_t> y_zero_point{5};
1750+
1751+
const std::vector<int8_t> X1{1, 2, 3, 4};
1752+
const std::vector<float> X1_scale{0.1f};
1753+
const std::vector<int8_t> X1_zero_point{0};
1754+
1755+
const std::vector<int8_t> X2{5, 6, 7, 8};
1756+
const std::vector<float> X2_scale{0.1f};
1757+
const std::vector<int8_t> X2_zero_point{0};
1758+
1759+
const std::vector<int8_t> expected_output{6, 7, 10, 11, 8, 9, 12, 13};
1760+
1761+
test_case.add_input<float>(Shape{1}, y_scale);
1762+
test_case.add_input<int8_t>(Shape{1}, y_zero_point);
1763+
1764+
test_case.add_input<int8_t>(Shape{2, 2}, X1);
1765+
test_case.add_input<float>(Shape{1}, X1_scale);
1766+
test_case.add_input<int8_t>(Shape{1}, X1_zero_point);
1767+
1768+
test_case.add_input<int8_t>(Shape{2, 2}, X2);
1769+
test_case.add_input<float>(Shape{1}, X2_scale);
1770+
test_case.add_input<int8_t>(Shape{1}, X2_zero_point);
1771+
1772+
test_case.add_expected_output<int8_t>(Shape{2, 4}, expected_output);
1773+
test_case.run();
1774+
}
1775+
1776+
OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_qlinear_concat_u8) {
1777+
const auto model = convert_model("com.microsoft/qlinear_concat_u8.onnx");
1778+
auto test_case = ov::test::TestCase(model, s_device);
1779+
1780+
const std::vector<float> y_scale{0.1f};
1781+
const std::vector<uint8_t> y_zero_point{5};
1782+
1783+
const std::vector<uint8_t> X1{10, 20, 30, 40, 50, 60, 15, 25, 35, 45, 55, 65,
1784+
12, 22, 32, 42, 52, 62, 18, 28, 38, 48, 58, 68};
1785+
const std::vector<float> X1_scale{0.1f};
1786+
const std::vector<uint8_t> X1_zero_point{0};
1787+
1788+
const std::vector<uint8_t> X2{70, 80, 90, 100, 110, 120, 75, 85, 95, 105, 115, 125,
1789+
72, 82, 92, 102, 112, 122, 78, 88, 98, 108, 118, 128};
1790+
const std::vector<float> X2_scale{0.1f};
1791+
const std::vector<uint8_t> X2_zero_point{0};
1792+
1793+
const std::vector<uint8_t> expected_output{
1794+
15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130,
1795+
17, 27, 37, 47, 57, 67, 77, 87, 97, 107, 117, 127, 23, 33, 43, 53, 63, 73, 83, 93, 103, 113, 123, 133};
1796+
1797+
test_case.add_input<float>(Shape{1}, y_scale);
1798+
test_case.add_input<uint8_t>(Shape{1}, y_zero_point);
1799+
1800+
test_case.add_input<uint8_t>(Shape{4, 6}, X1);
1801+
test_case.add_input<float>(Shape{1}, X1_scale);
1802+
test_case.add_input<uint8_t>(Shape{1}, X1_zero_point);
1803+
1804+
test_case.add_input<uint8_t>(Shape{4, 6}, X2);
1805+
test_case.add_input<float>(Shape{1}, X2_scale);
1806+
test_case.add_input<uint8_t>(Shape{1}, X2_zero_point);
1807+
1808+
test_case.add_expected_output<uint8_t>(Shape{4, 12}, expected_output);
1809+
test_case.run();
1810+
}

0 commit comments

Comments
 (0)