Skip to content
Snippets Groups Projects
Commit 771385da authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[Util] allow returning full context with execute_parent

parent be7a79a7
No related branches found
No related tags found
No related merge requests found
...@@ -162,7 +162,7 @@ def get_trained_network_and_ishape(topology, wbits, abits): ...@@ -162,7 +162,7 @@ def get_trained_network_and_ishape(topology, wbits, abits):
return (model, ishape) return (model, ishape)
def execute_parent(parent_path, child_path, input_tensor_npy): def execute_parent(parent_path, child_path, input_tensor_npy, return_full_ctx=False):
"""Execute parent model containing a single StreamingDataflowPartition by """Execute parent model containing a single StreamingDataflowPartition by
replacing it with the model at child_path and return result.""" replacing it with the model at child_path and return result."""
...@@ -173,5 +173,7 @@ def execute_parent(parent_path, child_path, input_tensor_npy): ...@@ -173,5 +173,7 @@ def execute_parent(parent_path, child_path, input_tensor_npy):
sdp_node = getCustomOp(sdp_node) sdp_node = getCustomOp(sdp_node)
sdp_node.set_nodeattr("model", child_path) sdp_node.set_nodeattr("model", child_path)
ret = execute_onnx(parent_model, {iname: input_tensor_npy}, True) ret = execute_onnx(parent_model, {iname: input_tensor_npy}, True)
y = ret[oname] if return_full_ctx:
return y return ret
else:
return ret[oname]
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