diff options
author | Mike Kelly <mike.kelly@arm.com> | 2023-12-20 12:48:02 +0000 |
---|---|---|
committer | mike.kelly <mike.kelly@arm.com> | 2023-12-20 19:40:53 +0000 |
commit | a7bd3fa77431f0e99698f24e325b85df459d3b10 (patch) | |
tree | e6af0301ea73f0514fa599a174801a5aa7ae0d77 /src/backends/cl/ClBackend.cpp | |
parent | 399d1001eba374d266c30e1e3239d6321e731339 (diff) | |
download | armnn-a7bd3fa77431f0e99698f24e325b85df459d3b10.tar.gz |
IVGCVSW-7830 Remove Reshape where possible
* Remove reshape on ClBackend
* Remove unnecessary restriction on NeonBackend remove Reshape
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: I79940c9f8609d19b79f2fbe55225ffc8f0d90c25
Diffstat (limited to 'src/backends/cl/ClBackend.cpp')
-rw-r--r-- | src/backends/cl/ClBackend.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/backends/cl/ClBackend.cpp b/src/backends/cl/ClBackend.cpp index 1d8ae21e5d..6d191a594b 100644 --- a/src/backends/cl/ClBackend.cpp +++ b/src/backends/cl/ClBackend.cpp @@ -673,6 +673,19 @@ OptimizationViews ClBackend::OptimizeSubgraphView(const SubgraphView& subgraph, } } + // Remove Reshape where possible + if (base.GetType() == LayerType::Reshape) + { + ReshapeLayer* baseLayer = PolymorphicDowncast<ReshapeLayer*>(&base); + + // Cannot remove a Reshape if it's connected to any layer that has an NCHW layout + if (ConnectedToLayerWithNCHW(baseLayer)) + { + continue; + } + RemoveReshapeLayer(baseLayer, untouched, optimizationViews); + } + // Special case to fuse padding into average pooling 2d for quantized datatype. // Required to be done as a backend specific optimization as Neon does not support this special case. if (base.GetType() == LayerType::Pooling2d) |