Skip to content

Commit 3ff6ee2

Browse files
committed
Simplify model error message in test | test(torchlib)
Remove the duplicate check_model message when displaying [ghstack-poisoned]
1 parent 5bde197 commit 3ff6ee2

2 files changed

Lines changed: 2 additions & 16 deletions

File tree

onnxscript/tests/function_libs/torch_lib/ops_test.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from __future__ import annotations
1717

1818
import unittest
19-
from typing import Any, Callable, Optional, Sequence, Tuple
19+
from typing import Callable, Optional, Sequence, Tuple
2020

2121
import numpy as np
2222
import onnx
@@ -72,18 +72,6 @@ def _should_skip_xfail_test_sample(
7272
return None, None
7373

7474

75-
def _split_function_and_wrangler(
76-
onnx_function_and_wrangler: Callable[..., Any]
77-
| tuple[Callable[..., Any], Callable[..., Any]]
78-
) -> tuple[Callable[..., Any], Callable[..., Any] | None]:
79-
"""Splits a function with an optional input wrangler into a function and an input wrangler."""
80-
if isinstance(onnx_function_and_wrangler, tuple):
81-
return onnx_function_and_wrangler
82-
83-
assert callable(onnx_function_and_wrangler)
84-
return onnx_function_and_wrangler, None
85-
86-
8775
class TestFunctionValidity(unittest.TestCase):
8876
def test_all_script_functions_are_onnx_functions(self):
8977
for info in ops_test_data.TESTED_TORCHLIB_OPS:

onnxscript/tests/function_libs/torch_lib/ops_test_common.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,7 @@ def _capture_graph_and_evaluate_torch_script_evaluator(function: Callable, args,
517517
onnx.checker.check_model(onnx_model, full_check=True)
518518
except onnx.checker.ValidationError as e:
519519
raise AssertionError(
520-
f"ONNX model is invalid: {e}. "
521-
f"Model:\n"
522-
f"{onnxscript.proto2text(onnx_model)}"
520+
f"ONNX model is invalid. Model:\n{onnxscript.proto2text(onnx_model)}"
523521
) from e
524522

525523
try:

0 commit comments

Comments
 (0)