From 7695eb077dc6f74f4e09722c0ef9019882b6b49c Mon Sep 17 00:00:00 2001 From: Yaman Umuroglu <maltanar@gmail.com> Date: Mon, 11 May 2020 23:10:17 +0100 Subject: [PATCH] [Core] check topological sorting before execution --- src/finn/core/onnx_exec.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/finn/core/onnx_exec.py b/src/finn/core/onnx_exec.py index 172ba25b2..44787e1d2 100644 --- a/src/finn/core/onnx_exec.py +++ b/src/finn/core/onnx_exec.py @@ -38,6 +38,7 @@ from finn.core.modelwrapper import ModelWrapper from finn.core.remote_exec import remote_exec from finn.core.rtlsim_exec import rtlsim_exec from finn.custom_op.registry import getCustomOp +import finn.analysis.topology as ta def execute_node(node, context, graph): @@ -121,6 +122,11 @@ def execute_onnx(model, input_dict, return_full_exec_context=False): if not model.check_all_tensor_shapes_specified(): raise Exception("Found unspecified tensor shapes, try infer_shapes") + ret = model.analysis(ta.nodes_topologically_sorted) + assert ( + ret["nodes_topologically_sorted"] is True + ), """Nodes must be + topologically sorted.""" graph = model.graph # first, we need to make sure that every variable required by the graph has -- GitLab