Skip to content

Commit 075becd

Browse files
committed
cov
1 parent 37ce239 commit 075becd

File tree

3 files changed

+37
-18
lines changed

3 files changed

+37
-18
lines changed

_unittests/ut_xrun_doc/test_helpers.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
rename_dynamic_dimensions,
3030
rename_dynamic_expression,
3131
)
32+
from onnx_diagnostic.cache_helpers import make_dynamic_cache
3233

3334
TFLOAT = onnx.TensorProto.FLOAT
3435

@@ -94,6 +95,32 @@ def test_pretty_onnx(self):
9495
pretty_onnx(proto.graph)
9596
pretty_onnx(proto.graph.node[0])
9697

98+
@hide_stdout()
99+
def test_print_pretty_onnx(self):
100+
proto = oh.make_model(
101+
oh.make_graph(
102+
[
103+
oh.make_node("Sigmoid", ["Y"], ["sy"]),
104+
oh.make_node("Mul", ["Y", "sy"], ["ysy"]),
105+
oh.make_node("Mul", ["X", "ysy"], ["final"]),
106+
],
107+
"nd",
108+
[
109+
oh.make_tensor_value_info("X", TFLOAT, [1, "b", "c"]),
110+
oh.make_tensor_value_info("Y", TFLOAT, ["a", "b", "c"]),
111+
],
112+
[oh.make_tensor_value_info("final", TFLOAT, ["a", "b", "c"])],
113+
),
114+
opset_imports=[oh.make_opsetid("", 18)],
115+
ir_version=9,
116+
)
117+
self.print_onnx(proto)
118+
self.print_model(proto)
119+
self.dump_onnx("test_print_pretty_onnx", proto)
120+
self.check_ort(proto)
121+
self.assertNotEmpty(proto)
122+
self.assertEmpty(None)
123+
97124
def test_get_onnx_signature(self):
98125
proto = oh.make_model(
99126
oh.make_graph(
@@ -121,6 +148,12 @@ def test_flatten(self):
121148
[
122149
torch.rand((5, 6), dtype=torch.float16),
123150
torch.rand((5, 6, 7), dtype=torch.float16),
151+
{
152+
"a": torch.rand((2,), dtype=torch.float16),
153+
"cache": make_dynamic_cache(
154+
[(torch.rand((4, 4, 4)), torch.rand((4, 4, 4)))]
155+
),
156+
},
124157
],
125158
)
126159
flat = flatten_object(inputs)

_unittests/ut_xrun_doc/test_unit_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
is_linux,
1414
unit_test_going,
1515
measure_time,
16+
has_cuda,
17+
has_onnxscript,
1618
)
1719

1820

@@ -65,6 +67,8 @@ def test_is(self):
6567
is_azure()
6668
is_linux()
6769
unit_test_going()
70+
has_cuda()
71+
has_onnxscript()
6872

6973
def test_measure_time(self):
7074
res = measure_time(lambda: math.cos(0.5))

onnx_diagnostic/ext_test_case.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,6 @@ def skipif_ci_apple(msg) -> Callable:
6262
return lambda x: x
6363

6464

65-
def with_path_append(path_to_add: Union[str, List[str]]) -> Callable:
66-
"""Adds a path to sys.path to check."""
67-
68-
def wraps(f, path_to_add=path_to_add):
69-
def wrapped(self, path_to_add=path_to_add):
70-
cpy = sys.path.copy()
71-
if path_to_add is not None:
72-
if isinstance(path_to_add, str):
73-
path_to_add = [path_to_add]
74-
sys.path.extend(path_to_add)
75-
f(self)
76-
sys.path = cpy
77-
78-
return wrapped
79-
80-
return wraps
81-
82-
8365
def unit_test_going():
8466
"""
8567
Enables a flag telling the script is running while testing it.

0 commit comments

Comments
 (0)