From 7bada4039d01836c995a12251034777055e1848a Mon Sep 17 00:00:00 2001 From: Patrik Gustavsson Date: Thu, 28 Jan 2021 15:46:21 +0100 Subject: MLBEDSW-3772 Fix unfusing ConcatTFlite unfuse_activation_function moved into rewrite_concat_ops Need to be handled before converting ConcatTFlite to ConcatSliceWrite. Signed-off-by: Patrik Gustavsson Change-Id: Ieeaed4d28b38de3a8dcacaf708962b9d8161a161 --- ethosu/vela/graph_optimiser.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ethosu/vela/graph_optimiser.py b/ethosu/vela/graph_optimiser.py index bb5a9e03..f1b2d35c 100644 --- a/ethosu/vela/graph_optimiser.py +++ b/ethosu/vela/graph_optimiser.py @@ -68,6 +68,8 @@ def rewrite_concat_ops(op, arch, nng): ofm.ops = [] offset = 0 + unfuse_activation_function(op) + if op.type == Op.Pack: # Pack is also referred to as Stack axis = int(op.attrs["axis"]) @@ -367,7 +369,7 @@ def convert_batched_fc_shape(op, arch, nng): return op -def unfuse_activation_function(op, arch, nng): +def unfuse_activation_function(op): if op.type == Op.ConcatTFLite and op.run_on_npu and op.activation is not None: act_op = Operation(op.activation.op_type, op.name + op.activation.op_type.name) op.activation = None @@ -378,8 +380,6 @@ def unfuse_activation_function(op, arch, nng): op.set_output_tensor(intermediate_tens) act_op.set_ifm_ofm_shapes() - return op - def rewrite_stridedslice_output(op, arch, nng): if not op.run_on_npu or op.type != Op.StridedSlice: @@ -1233,7 +1233,6 @@ def optimise_graph_a(nng, arch, verbose_graph=False): convert_softmax, optimise_strided_conv, convert_batched_fc_shape, - unfuse_activation_function, fixup_conv2d_backprop, fixup_relus_with_differing_ifm_ofm_scaling, fixup_act_reorder, -- cgit v1.2.1