diff options
author | Charles Xu <charles.xu@arm.com> | 2020-08-05 15:40:44 +0200 |
---|---|---|
committer | Charles Xu <charles.xu@arm.com> | 2020-08-06 09:22:09 +0200 |
commit | 36ffaf3b7b5eda1cc1e88a8dc2a0882d910742bd (patch) | |
tree | 47bf77ee4e96e704a2dacf14cf601f0860243ff7 | |
parent | bef228bb19ff01bdab8c0b7570ddc4e4f7cdeeb6 (diff) | |
download | ethos-u-vela-36ffaf3b7b5eda1cc1e88a8dc2a0882d910742bd.tar.gz |
Skip the NOP resizebilinear op
Signed-off-by: Charles Xu <charles.xu@arm.com>
Change-Id: Ibd0cd152fbc46dea0c92fd1bf7da1ffc9803fdba
-rw-r--r-- | ethosu/vela/graph_optimiser.py | 4 | ||||
-rw-r--r-- | ethosu/vela/supported_operators.py | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/ethosu/vela/graph_optimiser.py b/ethosu/vela/graph_optimiser.py index 9c6e1f5b..a9d5cce5 100644 --- a/ethosu/vela/graph_optimiser.py +++ b/ethosu/vela/graph_optimiser.py @@ -212,6 +212,10 @@ def fixup_resizebilinear(op, arch): if op.type == "ResizeBilinear": if op.inputs[0].shape[1] == 1 and op.inputs[0].shape[2] == 1: convert_resizebilinear_1x1_to_add(op) + elif op.inputs[0].shape == op.outputs[0].shape: + # Bypass nop resizebilinear + op.inputs = op.inputs[:1] + op.type = "Identity" return op diff --git a/ethosu/vela/supported_operators.py b/ethosu/vela/supported_operators.py index 73e219b5..b5853236 100644 --- a/ethosu/vela/supported_operators.py +++ b/ethosu/vela/supported_operators.py @@ -267,6 +267,8 @@ class SupportedOperators: if op.type == "ResizeBilinear": if op.inputs[0].shape[1] == 1 and op.inputs[0].shape[2] == 1: return True + if op.inputs[0].shape == op.outputs[0].shape: + return True upscaled_shape = [op.inputs[0].shape[1] * 2, op.inputs[0].shape[2] * 2] out_shape = op.outputs[0].shape[1:3] if not op.attrs["align_corners"] and out_shape != upscaled_shape: |