From fd627ffaec8fd8801d980b4c91ee7c0607ab6aaf Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 25 Feb 2021 17:44:00 +0000 Subject: IVGCVSW-5687 Update Doxygen Docu * Update Doxygen Documentation for 21.02 release Signed-off-by: Jan Eilers Change-Id: I9ed2f9caab038836ea99d7b378d7899fe431a4e5 --- ...optimize_consecutive_reshapes_8hpp_source.xhtml | 142 +++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 21.02/_optimize_consecutive_reshapes_8hpp_source.xhtml (limited to '21.02/_optimize_consecutive_reshapes_8hpp_source.xhtml') diff --git a/21.02/_optimize_consecutive_reshapes_8hpp_source.xhtml b/21.02/_optimize_consecutive_reshapes_8hpp_source.xhtml new file mode 100644 index 0000000000..c1c66c764a --- /dev/null +++ b/21.02/_optimize_consecutive_reshapes_8hpp_source.xhtml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/optimizations/OptimizeConsecutiveReshapes.hpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
OptimizeConsecutiveReshapes.hpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include "Optimization.hpp"
8 
9 namespace armnn
10 {
11 namespace optimizations
12 {
13 
15 {
16 public:
17  /// Run for every connection between a base ReshapeLayer and a child ReshapeLayer.
18  /// Inserts an equivalent ReshapeLayer that bypasses both for that connection.
19  void Run(Graph& graph, InputSlot& connection) const
20  {
21  Layer& base = connection.GetConnectedOutputSlot()->GetOwningLayer();
22  Layer& child = connection.GetOwningLayer();
23 
26 
27  OutputSlot* parentOut = base.GetInputSlot(0).GetConnectedOutputSlot();
28 
29  const TensorInfo& inInfo = parentOut->GetTensorInfo();
30  const TensorInfo& outInfo = child.GetOutputHandler().GetTensorInfo();
31 
32  // This Optimization is only appropriate when the base ReshapeLayer is connected to the child ReshapeLayer
33  // and no other Layer.
34  if (base.GetOutputSlot(0).GetNumConnections() > 1)
35  {
36  return;
37  }
38 
39  if (inInfo.GetShape() != outInfo.GetShape())
40  {
41  // Inserts equivalent reshape before base layer.
42  const std::string name = std::string("merged-") + base.GetName() + std::string("-with-") + child.GetName();
43  const ReshapeDescriptor descriptor{outInfo.GetShape()};
44  auto& newReshape = *graph.InsertNewLayer<ReshapeLayer>(base.GetInputSlot(0), descriptor, name.c_str());
45 
46  // Parent is now the new layer.
47  parentOut = &newReshape.GetOutputSlot();
48  }
49 
50  // Moves connections in child output to parent layer.
51  // Child layer will be removed as it's left unconnected.
52  // Base layer will be removed if left unconnected.
53  child.GetOutputSlot().MoveAllConnections(*parentOut);
54  }
55 
56 protected:
59 };
60 
62 
63 } // namespace optimizations
64 } // namespace armnn
+
const TensorShape & GetShape() const
Definition: Tensor.hpp:187
+ +
A ReshapeDescriptor for the ReshapeLayer.
+ +
Layer & GetOwningLayer() const
Definition: Layer.hpp:115
+
This layer represents a reshape operation.
+ +
Copyright (c) 2021 ARM Limited and Contributors.
+
unsigned int GetNumConnections() const override
Definition: Layer.hpp:138
+
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
Definition: Layer.hpp:316
+
void Run(Graph &graph, InputSlot &connection) const
Run for every connection between a base ReshapeLayer and a child ReshapeLayer.
+
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
Definition: Layer.hpp:265
+ +
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
+
const OutputSlot * GetConnectedOutputSlot() const
Definition: Layer.hpp:55
+ +
Layer & GetOwningLayer() const
Definition: Layer.hpp:52
+ + + +
const OutputHandler & GetOutputHandler(unsigned int i=0) const
Definition: Layer.hpp:225
+
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
Definition: Layer.hpp:318
+
const char * GetName() const override
Returns the name of the layer.
Definition: Layer.hpp:311
+ +
LayerT * InsertNewLayer(InputSlot &insertBefore, Args &&... args)
Inserts a new layer between the output slot currently connected to insertBefore and insertBefore itse...
Definition: Graph.hpp:416
+
void MoveAllConnections(OutputSlot &destination)
Moves all connections to another OutputSlot.
Definition: Layer.cpp:116
+ +
const TensorInfo & GetTensorInfo() const
Gets the matching TensorInfo for the output.
+
+
+ + + + -- cgit v1.2.1