From 6940dd720ebb6b3d1df8ca203ab696daefe58189 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Fri, 20 Mar 2020 12:25:56 +0000 Subject: renamed Documentation folder 20.02 and added .nojekyll file Signed-off-by: Jim Flynn --- 20.02/_squash_equal_siblings_8hpp_source.xhtml | 134 +++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 20.02/_squash_equal_siblings_8hpp_source.xhtml (limited to '20.02/_squash_equal_siblings_8hpp_source.xhtml') diff --git a/20.02/_squash_equal_siblings_8hpp_source.xhtml b/20.02/_squash_equal_siblings_8hpp_source.xhtml new file mode 100644 index 0000000000..c8fc4f0258 --- /dev/null +++ b/20.02/_squash_equal_siblings_8hpp_source.xhtml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/optimizations/SquashEqualSiblings.hpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
SquashEqualSiblings.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 
10 
11 namespace armnn
12 {
13 namespace optimizations
14 {
15 
16 template <typename Comparable>
18 {
19 public:
20  /// Run for every connection between a base Layer (any) and a child ComparableLayer.
21  /// For all siblings of the child layer that compare equal to it, bypasses and removes
22  /// them. I.e., moves the connections in the outputs of the siblings to the outputs of
23  /// the child layer, so the siblings are left unconnected (and later removed).
24  void Run(Graph& graph, InputSlot& connection) const
25  {
26  IgnoreUnused(graph);
27  auto& child = connection.GetOwningLayer();
28 
29  if (!child.IsOutputUnconnected())
30  {
31  OutputSlot& baseOutput = *connection.GetConnectedOutputSlot();
32 
33  if (baseOutput.GetNumConnections() > 1)
34  {
35  auto& comparableChild = *boost::polymorphic_downcast<Comparable*>(&child);
36 
37  Layer* lowestPriorityChild = &child;
38  for (auto&& it : baseOutput.GetConnections())
39  {
40  Layer* sibling = &it->GetOwningLayer();
41  if ((sibling != lowestPriorityChild) && comparableChild.IsEqual(*sibling))
42  {
43  if (sibling->GetPriority() < lowestPriorityChild->GetPriority())
44  {
45  std::swap(sibling, lowestPriorityChild);
46  }
47  // Bypasses sibling. It will be removed as it's left unconnected.
48  auto siblingOut = sibling->BeginOutputSlots();
49  for (auto lowestPriorityChildOut = lowestPriorityChild->BeginOutputSlots();
50  lowestPriorityChildOut != lowestPriorityChild->EndOutputSlots(); ++lowestPriorityChildOut)
51  {
52  siblingOut->MoveAllConnections(*lowestPriorityChildOut);
53  ++siblingOut;
54  }
55  }
56  }
57  }
58  }
59  }
60 
61 protected:
62  SquashEqualSiblingsImpl() = default;
63  ~SquashEqualSiblingsImpl() = default;
64 };
65 
70 
71 } // namespace optimizations
72 } // namespace armnn
+ +
const std::vector< InputSlot * > & GetConnections() const
Definition: Layer.hpp:125
+ +
void swap(OriginsDescriptor &first, OriginsDescriptor &second)
+ + +
Copyright (c) 2020 ARM Limited.
+
void IgnoreUnused(Ts &&...)
+
unsigned int GetNumConnections() const override
Definition: Layer.hpp:138
+
LayerPriority GetPriority() const
Definition: Layer.cpp:288
+ +
const OutputSlot * GetConnectedOutputSlot() const
Definition: Layer.hpp:55
+
Layer & GetOwningLayer() const
Definition: Layer.hpp:52
+ + +
This layer represents a transpose operation.
+
std::vector< OutputSlot >::iterator BeginOutputSlots()
Definition: Layer.hpp:239
+ +
void Run(Graph &graph, InputSlot &connection) const
Run for every connection between a base Layer (any) and a child ComparableLayer.
+ +
+
+ + + + -- cgit v1.2.1