Skip to content

Commit b73a0cb

Browse files
committed
tiny changes
1 parent 1d62c51 commit b73a0cb

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Binary file not shown.

_unittests/ut_graph_api/test_graph_builder.py renamed to _unittests/ut_graph_api/test_graph_builder_optim.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import unittest
23
import onnx
34
from onnx_array_api.ext_test_case import ExtTestCase
@@ -53,6 +54,26 @@ def test_keep_unused_outputs(self):
5354
self.assertEqual(len(onx.graph.node), 2)
5455
self.assertEqual(onx.graph.node[0].op_type, "Split")
5556

57+
def test_check_files(self):
58+
import onnxruntime
59+
60+
data = os.path.join(os.path.dirname(__file__), "data")
61+
filename = [f for f in os.listdir(data) if f.endswith(".onnx")]
62+
for f in filename:
63+
with self.subTest(f=f):
64+
onx = onnx.load(os.path.join(data, f))
65+
sess = onnxruntime.InferenceSession(
66+
os.path.join(data, f), providers=["CPUExecutionProvider"]
67+
)
68+
assert sess
69+
g = GraphBuilder(onx)
70+
g.optimize()
71+
onx2 = g.to_onnx()
72+
sess2 = onnxruntime.InferenceSession(
73+
onx2.SerializeToString(), providers=["CPUExecutionProvider"]
74+
)
75+
assert sess2
76+
5677

5778
if __name__ == "__main__":
5879
unittest.main(verbosity=2)

0 commit comments

Comments
 (0)