-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Liqun Fu <liqfu@microsoft.com>
- Loading branch information
Showing
13 changed files
with
120 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,12 @@ | |
make_tensor_value_info, | ||
) | ||
from onnx.numpy_helper import from_array | ||
from onnx.shape_inference import InferenceError, InferenceErrorMode, ShapeError, infer_node_outputs | ||
|
||
from onnx.shape_inference import ( | ||
InferenceError, | ||
Check warning Code scanning / lintrunner RUFF/F401 Warning
onnx.shape\_inference.InferenceError imported but unused.
See https://docs.astral.sh/ruff/rules/unused-import |
||
InferenceErrorMode, | ||
ShapeError, | ||
infer_node_outputs, | ||
) | ||
Check notice Code scanning / CodeQL Unused import Note
Import of 'InferenceError' is not used.
|
||
|
||
ADD_SCHEMA = max( | ||
(s for s in get_all_schemas_with_history() if s.name == "Add" and s.domain == ""), | ||
|
@@ -237,9 +241,13 @@ def test_inference_with_conflow(self) -> None: | |
} | ||
""" | ||
model = onnx.parser.parse_model(model_script) | ||
onnx.shape_inference.infer_shapes(model, error_mode=InferenceErrorMode.IgnoreInferenceError) | ||
onnx.shape_inference.infer_shapes( | ||
model, error_mode=InferenceErrorMode.IgnoreInferenceError | ||
) | ||
with self.assertRaises(ShapeError): | ||
onnx.shape_inference.infer_shapes(model, error_mode=InferenceErrorMode.FailAnyInferenceError) | ||
onnx.shape_inference.infer_shapes( | ||
model, error_mode=InferenceErrorMode.FailAnyInferenceError | ||
) | ||
|
||
def test_inference_with_attribute(self) -> None: | ||
model_script = """ | ||
|
@@ -274,7 +282,9 @@ def test_inference_with_attribute(self) -> None: | |
} | ||
""" | ||
model = onnx.parser.parse_model(model_script) | ||
onnx.shape_inference.infer_shapes(model, error_mode=InferenceErrorMode.FailAnyInferenceError) | ||
onnx.shape_inference.infer_shapes( | ||
model, error_mode=InferenceErrorMode.FailAnyInferenceError | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.