12 Optimizer::Optimizer()
22 bool graphNeedsSorting =
false;
29 for (
auto&& optimization : optimizations)
32 optimization->Run(graph, **it);
34 if ((*it)->IsOutputUnconnected())
39 graphNeedsSorting =
true;
43 for (
auto& erasedLayerName : erasedLayerNamesObservable)
45 for (
auto& addedLayer : addedLayerObservable)
47 addedLayer->AddRelatedLayerName(erasedLayerName);
51 erasedLayerNamesObservable.Clear();
52 addedLayerObservable.
Clear();
54 if (graphNeedsSorting)
56 graphNeedsSorting =
false;
Iterator begin()
Returns iterator pointing to the beginning of the list. Lowercase for range-based for loops...
void EraseLayer(Iterator pos)
Deletes the layer at the specified position.
static void Pass(Graph &graph, const Optimizations &optimizations)
std::vector< OptimizationPtr > Optimizations
Copyright (c) 2020 ARM Limited.
Iterator GetPosInGraph(Layer &layer)
Gets the position of a layer in the graph.
Iterator end()
Returns iterator pointing to the end of the list. Lowercase for range-based for loops.
Graph & TopologicalSort()
Sorts layers in topological order and return this.