ArmNN
 24.02
Optimizer.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 <vector>
8 #include <memory>
9 #include "optimizations/All.hpp"
10 
11 namespace armnn
12 {
13 
14 class Optimizer
15 {
16 public:
17  using OptimizationPtr = std::unique_ptr<Optimization>;
18  using Optimizations = std::vector<OptimizationPtr>;
19 
20  static void Pass(Graph& graph, const Optimizations& optimizations);
21 
22 private:
23  ~Optimizer() = default;
24 
25  Optimizer();
26 };
27 
28 
29 template<typename T>
30 void Append(Optimizer::Optimizations& optimizations, T&& optimization)
31 {
32  optimizations.emplace_back(new T(optimization));
33 };
34 
35 template<typename Front, typename... Others>
36 void Append(Optimizer::Optimizations& optimizations, Front&& front, Others&&... others)
37 {
38  Append<Front>(optimizations, std::forward<Front>(front));
39  Append<Others...>(optimizations, std::forward<Others>(others)...);
40 };
41 
42 template<typename... Args>
44 {
45  Optimizer::Optimizations optimizations;
46 
47  Append(optimizations, std::forward<Args>(args)...);
48 
49  return optimizations;
50 }
51 
52 } // namespace armnn
All.hpp
armnn::Append
void Append(Optimizer::Optimizations &optimizations, T &&optimization)
Definition: Optimizer.hpp:30
armnn::Optimizer::Optimizations
std::vector< OptimizationPtr > Optimizations
Definition: Optimizer.hpp:18
armnn::Optimizer
Definition: Optimizer.hpp:14
armnn::MakeOptimizations
Optimizer::Optimizations MakeOptimizations(Args &&... args)
Definition: Optimizer.hpp:43
armnn::Optimizer::OptimizationPtr
std::unique_ptr< Optimization > OptimizationPtr
Definition: Optimizer.hpp:17
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::Optimizer::Pass
static void Pass(Graph &graph, const Optimizations &optimizations)
Definition: Optimizer.cpp:16
armnn::Graph
Definition: Graph.hpp:30