diff --git a/extra/onnx.py b/extra/onnx.py index da623743b0..b2a65aa44d 100644 --- a/extra/onnx.py +++ b/extra/onnx.py @@ -401,7 +401,7 @@ class OnnxRunner: def __init__(self, model_path: Tensor | str | pathlib.Path): model = OnnxPBParser(model_path, load_external_data=True).parse() graph = model["graph"] - self.is_training = any(n['domain'] in {Domain.AI_ONNX_TRAINING, Domain.AI_ONNX_PREVIEW_TRAINING} for n in graph["node"]) + self.is_training = any(n['parsed_node'].opset_id.domain in {Domain.AI_ONNX_TRAINING, Domain.AI_ONNX_PREVIEW_TRAINING} for n in graph["node"]) self.graph_values = {"": None, **{i["name"]: i["parsed_tensor"] for i in graph["initializer"]}} self.graph_inputs = {i["name"]: i["parsed_type"] for i in graph["input"] if i["name"] not in self.graph_values} self.graph_outputs = tuple(o["name"] for o in graph["output"]) diff --git a/test/external/external_test_onnx_ops.py b/test/external/external_test_onnx_ops.py index ad620e594d..8ed0ddc03e 100644 --- a/test/external/external_test_onnx_ops.py +++ b/test/external/external_test_onnx_ops.py @@ -294,7 +294,6 @@ class TestTrainingOnnxOps(TestOnnxOps): outputs = ["X_out", "V_out"] self._validate_training("Momentum", onnx_fxn, inputs, attributes, outputs) - @unittest.expectedFailure # TODO: regression from removing StrEnum in Domain def test_adam_t_greater_than_zero(self): from onnx.backend.test.case.node.adam import apply_adam for t in [1, 3, 100]: