Skip to content
Snippets Groups Projects
Commit 6e19c660 authored by auphelia's avatar auphelia
Browse files

[Execution] Added if tree to read out the attribute backend to enable the path...

[Execution] Added if tree to read out the attribute backend to enable the path for executing of hls lib custom nodes
parent 3db6f927
No related branches found
No related tags found
No related merge requests found
# 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.")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment