From 6e19c660eb10c8d2ac73a353aa4c39f6e0b8be91 Mon Sep 17 00:00:00 2001
From: auphelia <jakobapk@web.de>
Date: Mon, 11 Nov 2019 15:12:26 +0000
Subject: [PATCH] [Execution] Added if tree to read out the attribute backend
 to enable the path for executing of hls lib custom nodes

---
 src/finn/core/execute_custom_node.py | 32 ++++++++++++++++++----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/src/finn/core/execute_custom_node.py b/src/finn/core/execute_custom_node.py
index 62d8b7fc1..dcd35d27e 100644
--- a/src/finn/core/execute_custom_node.py
+++ b/src/finn/core/execute_custom_node.py
@@ -1,21 +1,31 @@
 # import onnx.helper as helper
-
+import sys
 import finn.core.multithreshold as multiThresh
+import finn.core.utils as util
 
 
 def execute_custom_node(node, context, graph):
     """Call custom implementation to execute a single custom node.
     Input/output provided via context."""
 
-    if node.op_type == "MultiThreshold":
-        # save inputs
-        v = context[node.input[0]]
-        thresholds = context[node.input[1]]
-        # calculate output
-        output = multiThresh.execute(v, thresholds)
-        # setting context according to output
-        context[node.output[0]] = output
+    if (util.get_by_name(node.attribute, 'backend')) is not None:
+        if node.op_type == "StreamingMaxPool":
+            sys.exit(0)
+        else:
+            # exception if op_type is not supported
+            raise Exception("This hls lib custom node is currently not supported.")
 
+    
     else:
-        # exception if op_type is not supported
-        raise Exception("This custom node is currently not supported.")
+        if node.op_type == "MultiThreshold":
+            # save inputs
+            v = context[node.input[0]]
+            thresholds = context[node.input[1]]
+            # calculate output
+            output = multiThresh.execute(v, thresholds)
+            # setting context according to output
+            context[node.output[0]] = output
+
+        else:
+            # exception if op_type is not supported
+            raise Exception("This custom node is currently not supported.")
-- 
GitLab