From 8d2ca734165a068478df7cffa46185680b05cd20 Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Fri, 24 Feb 2023 10:28:19 +0000 Subject: Update Doxygen docu for 23.02 Signed-off-by: Nikhil Raj Change-Id: Ie6c19a27d50fefab2796b2b5875374e81f5bf971 --- 23.02/_optimizer_8cpp_source.xhtml | 131 +++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 23.02/_optimizer_8cpp_source.xhtml (limited to '23.02/_optimizer_8cpp_source.xhtml') diff --git a/23.02/_optimizer_8cpp_source.xhtml b/23.02/_optimizer_8cpp_source.xhtml new file mode 100644 index 0000000000..ae8b64e359 --- /dev/null +++ b/23.02/_optimizer_8cpp_source.xhtml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/Optimizer.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  23.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
Optimizer.cpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #include "Optimizer.hpp"
6 #include "Observable.hpp"
7 #include "optimizations/All.hpp"
8 
9 namespace armnn
10 {
11 
12 Optimizer::Optimizer()
13 {
14 }
15 
16 void Optimizer::Pass(Graph& graph, const Optimizations& optimizations)
17 {
19  // Create observables to observe changes to the graph
20  AddedLayerObservable addedLayerObservable(graph);
21  ErasedLayerNamesObservable erasedLayerNamesObservable(graph);
22 
23  bool graphNeedsSorting = false;
24  auto it = graph.TopologicalSort().end();
25 
26  // Calls TopologicalSort() for every iteration to re-order the list in case layers were added/removed.
27  while (it != graph.TopologicalSort().begin())
28  {
29  --it;
30  for (auto&& optimization : optimizations)
31  {
32  ARMNN_ASSERT(*it);
33  optimization->Run(graph, **it);
34 
35  if ((*it)->IsOutputUnconnected())
36  {
37  auto next = std::next(graph.GetPosInGraph(**it));
38  graph.EraseLayer(it);
39  it = next;
40  graphNeedsSorting = true;
41  }
42 
43  // Add the names of erased layers as related layers to the new added layers
44  for (auto& erasedLayerName : erasedLayerNamesObservable)
45  {
46  for (auto& addedLayer : addedLayerObservable)
47  {
48  addedLayer->AddRelatedLayerName(erasedLayerName);
49  }
50  }
51 
52  erasedLayerNamesObservable.Clear();
53  addedLayerObservable.Clear();
54 
55  if (graphNeedsSorting)
56  {
57  graphNeedsSorting = false;
58  break;
59  }
60  }
61  }
62 }
63 
64 } // namespace armnn
Iterator begin()
Returns iterator pointing to the beginning of the list. Lowercase for range-based for loops...
Definition: Graph.hpp:169
+
void EraseLayer(Iterator pos)
Deletes the layer at the specified position.
Definition: Graph.hpp:504
+
static void Pass(Graph &graph, const Optimizations &optimizations)
Definition: Optimizer.cpp:16
+
std::vector< OptimizationPtr > Optimizations
Definition: Optimizer.hpp:18
+ +
Copyright (c) 2021 ARM Limited and Contributors.
+
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:220
+ + +
Iterator GetPosInGraph(Layer &layer)
Gets the position of a layer in the graph.
Definition: Graph.hpp:448
+ + + +
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
+ +
Iterator end()
Returns iterator pointing to the end of the list. Lowercase for range-based for loops.
Definition: Graph.hpp:171
+
Graph & TopologicalSort()
Sorts layers in topological order and return this.
Definition: Graph.hpp:184
+ +
+
+ + + + -- cgit v1.2.1