• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include "Optimization.hpp"
8 #include "NetworkUtils.hpp"
9 
10 namespace armnn
11 {
12 namespace optimizations
13 {
14 
15 class AddDebugImpl
16 {
17 public:
18 
Run(Graph & graph,Layer & layer) const19     void Run(Graph& graph, Layer& layer) const
20     {
21         if (layer.GetType() != LayerType::Debug && layer.GetType() != LayerType::Output)
22         {
23             // if the inputs/outputs of this layer do not have a debug layer
24             // insert the debug layer after them
25             InsertDebugLayerAfter(graph, layer, false);
26         }
27     }
28 
29 protected:
30     AddDebugImpl() = default;
31     ~AddDebugImpl() = default;
32 };
33 
34 class AddDebugToFileImpl
35 {
36 public:
37 
Run(Graph & graph,Layer & layer) const38     void Run(Graph& graph, Layer& layer) const
39     {
40         if (layer.GetType() != LayerType::Debug && layer.GetType() != LayerType::Output)
41         {
42             // if the inputs/outputs of this layer do not have a debug layer
43             // insert the debug layer after them
44             InsertDebugLayerAfter(graph, layer, true);
45         }
46     }
47 
48 protected:
49     AddDebugToFileImpl() = default;
50     ~AddDebugToFileImpl() = default;
51 };
52 
53 using InsertDebugLayer = OptimizeForType<Layer, AddDebugImpl>;
54 using InsertDebugToFileLayer = OptimizeForType<Layer, AddDebugToFileImpl>;
55 
56 } // namespace optimizations
57 } // namespace armnn
58