diff options
author | Fredrik Svedberg <fredrik.svedberg@arm.com> | 2021-05-06 09:53:31 +0200 |
---|---|---|
committer | patrik.gustavsson <patrik.gustavsson@arm.com> | 2021-05-07 11:09:28 +0000 |
commit | c875aa6fdd8740f759305ff0fec9917977d019f0 (patch) | |
tree | d2ceca0ca8816a59fa029fdc39ec826d05533bb6 /ethosu/vela | |
parent | e6b94bb0a6d6021c5e575aef80fbcaaa332d7e33 (diff) | |
download | ethos-u-vela-c875aa6fdd8740f759305ff0fec9917977d019f0.tar.gz |
[MLBEDSW-4530] Improve --verbose-graph output
Improved --verbose-graph output by adding labels to each print.
Signed-off-by: Fredrik Svedberg <fredrik.svedberg@arm.com>
Change-Id: I49039ff6af1c06f49208591f02effa4ff73f982a
Diffstat (limited to 'ethosu/vela')
-rw-r--r-- | ethosu/vela/graph_optimiser.py | 4 | ||||
-rw-r--r-- | ethosu/vela/insert_dma.py | 2 | ||||
-rw-r--r-- | ethosu/vela/nn_graph.py | 8 |
3 files changed, 8 insertions, 6 deletions
diff --git a/ethosu/vela/graph_optimiser.py b/ethosu/vela/graph_optimiser.py index 99d4bf05..f4472f9e 100644 --- a/ethosu/vela/graph_optimiser.py +++ b/ethosu/vela/graph_optimiser.py @@ -1680,7 +1680,7 @@ def _record_optimised(op, arch): def optimise_graph_a(nng, arch, verbose_graph=False): if verbose_graph: - nng.print_graph() + nng.print_graph("Before Graph Optimization") pre_process_list = [ supported_operator_check, @@ -1783,5 +1783,5 @@ def optimise_graph_a(nng, arch, verbose_graph=False): rewrite_graph.visit_graph_post_order(sg.output_tensors, arch, [], [check_reshapes, _record_optimised]) if verbose_graph: - nng.print_graph() + nng.print_graph("After Graph Optimization") return nng diff --git a/ethosu/vela/insert_dma.py b/ethosu/vela/insert_dma.py index 3797f43e..bbe18f7b 100644 --- a/ethosu/vela/insert_dma.py +++ b/ethosu/vela/insert_dma.py @@ -106,5 +106,5 @@ def insert_dma_commands(nng, arch, verbose_graph=False): for idx, sg in enumerate(nng.subgraphs): nng.subgraphs[idx] = rewrite_graph.rewrite_graph_pre_order(nng, sg, arch, [], [insert_dma_cmd]) if verbose_graph: - nng.print_graph() + nng.print_graph("After DMA insertion") return nng diff --git a/ethosu/vela/nn_graph.py b/ethosu/vela/nn_graph.py index 677a385a..adc7904f 100644 --- a/ethosu/vela/nn_graph.py +++ b/ethosu/vela/nn_graph.py @@ -359,7 +359,9 @@ class Subgraph: s += "->" + str(dstt)[9:-2] print(s + " " + str(a)) - def print_graph(self): + def print_graph(self, label=None): + if label: + print(f"\n[ {label} ]") print("print_graph()", self.name) all_ops = self.get_all_ops() for idx, op in enumerate(all_ops): @@ -541,9 +543,9 @@ class Graph: for sg in self.subgraphs: sg.print_operators() - def print_graph(self): + def print_graph(self, label=None): for sg in self.subgraphs: - sg.print_graph() + sg.print_graph(label) def print_graph_with_tensors(self): for sg in self.subgraphs: |