diff --git a/examples/ONNX/ab.json b/examples/ONNX/ab.json index 3f9d5446..11338970 100644 --- a/examples/ONNX/ab.json +++ b/examples/ONNX/ab.json @@ -3,9 +3,9 @@ "format": "ModECI MDF v0.4", "generating_application": "Python modeci-mdf v0.4.7", "graphs": { - "torch_jit": { + "torch-jit-export": { "nodes": { - "/A/Add": { + "Add_1": { "input_ports": { "input": { "shape": [ @@ -19,7 +19,7 @@ "B": { "value": 1.0 }, - "/A/Add": { + "Add_1": { "function": "onnx::Add", "args": { "A": "input", @@ -28,14 +28,14 @@ } }, "output_ports": { - "_A_Add_output_0": { - "value": "/A/Add" + "onnx_Mul_2": { + "value": "Add_1" } } }, - "/B/Mul": { + "Mul_3": { "input_ports": { - "_A_Add_output_0": { + "onnx_Mul_2": { "shape": [ 2, 3 @@ -47,27 +47,27 @@ "B": { "value": 5.0 }, - "/B/Mul": { + "Mul_3": { "function": "onnx::Mul", "args": { - "A": "_A_Add_output_0", + "A": "onnx_Mul_2", "B": "B" } } }, "output_ports": { "_4": { - "value": "/B/Mul" + "value": "Mul_3" } } } }, "edges": { - "/A/Add._A_Add_output_0_/B/Mul._A_Add_output_0": { - "sender": "/A/Add", - "receiver": "/B/Mul", - "sender_port": "_A_Add_output_0", - "receiver_port": "_A_Add_output_0" + "Add_1.onnx_Mul_2_Mul_3.onnx_Mul_2": { + "sender": "Add_1", + "receiver": "Mul_3", + "sender_port": "onnx_Mul_2", + "receiver_port": "onnx_Mul_2" } } } diff --git a/examples/ONNX/ab.png b/examples/ONNX/ab.png index 8bd09968..d933cba6 100644 Binary files a/examples/ONNX/ab.png and b/examples/ONNX/ab.png differ diff --git a/examples/ONNX/ab.yaml b/examples/ONNX/ab.yaml index 861ee547..f3504f3f 100644 --- a/examples/ONNX/ab.yaml +++ b/examples/ONNX/ab.yaml @@ -2,9 +2,9 @@ ONNX Model: format: ModECI MDF v0.4 generating_application: Python modeci-mdf v0.4.7 graphs: - torch_jit: + torch-jit-export: nodes: - /A/Add: + Add_1: input_ports: input: shape: @@ -14,17 +14,17 @@ ONNX Model: parameters: B: value: 1.0 - /A/Add: + Add_1: function: onnx::Add args: A: input B: B output_ports: - _A_Add_output_0: - value: /A/Add - /B/Mul: + onnx_Mul_2: + value: Add_1 + Mul_3: input_ports: - _A_Add_output_0: + onnx_Mul_2: shape: - 2 - 3 @@ -32,17 +32,17 @@ ONNX Model: parameters: B: value: 5.0 - /B/Mul: + Mul_3: function: onnx::Mul args: - A: _A_Add_output_0 + A: onnx_Mul_2 B: B output_ports: _4: - value: /B/Mul + value: Mul_3 edges: - /A/Add._A_Add_output_0_/B/Mul._A_Add_output_0: - sender: /A/Add - receiver: /B/Mul - sender_port: _A_Add_output_0 - receiver_port: _A_Add_output_0 + Add_1.onnx_Mul_2_Mul_3.onnx_Mul_2: + sender: Add_1 + receiver: Mul_3 + sender_port: onnx_Mul_2 + receiver_port: onnx_Mul_2 diff --git a/examples/ONNX/abc.json b/examples/ONNX/abc.json index 63e7b14f..f31edc86 100644 --- a/examples/ONNX/abc.json +++ b/examples/ONNX/abc.json @@ -57,7 +57,7 @@ "nodes": { "Div_5": { "input_ports": { - "x_11": { + "x.11": { "shape": [ 2, 3 @@ -72,7 +72,7 @@ "Div_5": { "function": "onnx::Div", "args": { - "A": "x_11", + "A": "x.11", "B": "B" } } @@ -118,14 +118,14 @@ } }, "output_ports": { - "x_3": { + "x.3": { "value": "Loop_3" } } }, "Mul_8": { "input_ports": { - "x_3": { + "x.3": { "shape": [ 1 ], @@ -139,7 +139,7 @@ "Mul_8": { "function": "onnx::Mul", "args": { - "A": "x_3", + "A": "x.3", "B": "B" } } @@ -158,11 +158,11 @@ "sender_port": "onnx_Loop_3", "receiver_port": "onnx_Loop_3" }, - "Loop_3.x_3_Mul_8.x_3": { + "Loop_3.x.3_Mul_8.x.3": { "sender": "Loop_3", "receiver": "Mul_8", - "sender_port": "x_3", - "receiver_port": "x_3" + "sender_port": "x.3", + "receiver_port": "x.3" } } } diff --git a/examples/ONNX/abc.yaml b/examples/ONNX/abc.yaml index 376982e2..6ae8dbbe 100644 --- a/examples/ONNX/abc.yaml +++ b/examples/ONNX/abc.yaml @@ -41,7 +41,7 @@ ONNX Model: nodes: Div_5: input_ports: - x_11: + x.11: shape: - 2 - 3 @@ -52,7 +52,7 @@ ONNX Model: Div_5: function: onnx::Div args: - A: x_11 + A: x.11 B: B output_ports: x: @@ -77,11 +77,11 @@ ONNX Model: cond: cond v_initial: onnx_Loop_3 output_ports: - x_3: + x.3: value: Loop_3 Mul_8: input_ports: - x_3: + x.3: shape: - 1 type: float @@ -91,7 +91,7 @@ ONNX Model: Mul_8: function: onnx::Mul args: - A: x_3 + A: x.3 B: B output_ports: _13: @@ -102,8 +102,8 @@ ONNX Model: receiver: Loop_3 sender_port: onnx_Loop_3 receiver_port: onnx_Loop_3 - Loop_3.x_3_Mul_8.x_3: + Loop_3.x.3_Mul_8.x.3: sender: Loop_3 receiver: Mul_8 - sender_port: x_3 - receiver_port: x_3 + sender_port: x.3 + receiver_port: x.3 diff --git a/examples/ONNX/simple_ab.py b/examples/ONNX/simple_ab.py index 3418dccd..3b4aa5d3 100644 --- a/examples/ONNX/simple_ab.py +++ b/examples/ONNX/simple_ab.py @@ -100,7 +100,7 @@ def main(): for t in test_values: print("===================\nEvaluating MDF model with input: %s" % t) eg.evaluate(initializer={"input": t}) - print("Output: %s" % eg.enodes["/B/Mul"].evaluable_outputs["_4"].curr_value) + print("Output: %s" % eg.enodes["Mul_3"].evaluable_outputs["_4"].curr_value) if __name__ == "__main__": diff --git a/tests/interfaces/onnx/test_importer.py b/tests/interfaces/onnx/test_importer.py index f4fdd037..107e5870 100644 --- a/tests/interfaces/onnx/test_importer.py +++ b/tests/interfaces/onnx/test_importer.py @@ -26,7 +26,7 @@ def test_ab(): mdf_executable = EvaluableGraph(mdf_model.graphs[0], verbose=False) mdf_executable.evaluate(initializer={"input": test_input}) - mdf_output = mdf_executable.enodes["/B/Mul"].evaluable_outputs["_4"].curr_value + mdf_output = mdf_executable.enodes["Mul_3"].evaluable_outputs["_4"].curr_value # Get the translated ONNX model onnx_models = mdf_to_onnx(mdf_model) diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index 45b5356a..4bd7beba 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -69,7 +69,7 @@ def test_execution_engine_onnx(tmpdir): eg = modeci_mdf.execution_engine.main( "examples/ONNX/ab.%s" % mdf_format, array_format=array_format ) - output = eg.enodes["/B/Mul"].evaluable_outputs["_4"].curr_value + output = eg.enodes["Mul_3"].evaluable_outputs["_4"].curr_value assert np.array_equal(output, np.full((2, 3), 5))