diff options
author | Jacob Bohlin <jacob.bohlin@arm.com> | 2020-08-20 10:53:02 +0200 |
---|---|---|
committer | tim.hall <tim.hall@arm.com> | 2020-08-21 15:30:36 +0000 |
commit | 67e0d8f24fcb86115e834acd19dc57027b03ea4f (patch) | |
tree | 748a85cc9aca976b74e18d1e4bead38344c32922 /ethosu/vela/rewrite_graph.py | |
parent | 1575b9413de2569de25bb2520b898a91f24ad3b0 (diff) | |
download | ethos-u-vela-67e0d8f24fcb86115e834acd19dc57027b03ea4f.tar.gz |
MLBEDSW-2663: Handle optional tensors
Includes a number of changes:
* Handle non-existing optional inputs
* Handle disabled optional inputs (-1 indexed)
* Added unit tests for parsing operators
* Add bias tensor to the different Convolutions + FullyConnected if
it's missing.
Signed-off-by: Jacob Bohlin <jacob.bohlin@arm.com>
Change-Id: Ib88d2b610314b1c886fc0aef4f9da87430ce6ae5
Diffstat (limited to 'ethosu/vela/rewrite_graph.py')
-rw-r--r-- | ethosu/vela/rewrite_graph.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ethosu/vela/rewrite_graph.py b/ethosu/vela/rewrite_graph.py index 4f0d0107..e76e9617 100644 --- a/ethosu/vela/rewrite_graph.py +++ b/ethosu/vela/rewrite_graph.py @@ -69,10 +69,11 @@ def rewrite_graph_pre_order(sg, arch, tensor_rewrite_list, op_rewrite_list, rewr tens_visit_dict[tens] = res tens_visit_dict[res] = res - ops = res.ops - res.ops = [] - for op in ops: - res.ops.append(visit_op(op)) + if res: + ops = res.ops + res.ops = [] + for op in ops: + res.ops.append(visit_op(op)) return res sg.output_tensors = [visit_tens(tens) for tens in sg.output_tensors] @@ -142,6 +143,8 @@ def verify_subgraph_health(sg): op_visit_dict[op] = op for tens in op.inputs: + if not tens: + continue assert op in tens.consumers() visit_tens(tens) |