ie_icnn_network_stats.hpp
Go to the documentation of this file.
1 // Copyright (C) 2018-2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 /**
6  * @brief This is a header file for the ICNNNetworkStats class
7  *
8  * @file ie_icnn_network_stats.hpp
9  */
10 #pragma once
11 
12 #include <limits>
13 #include <map>
14 #include <memory>
15 #include <string>
16 #include <vector>
17 
18 #include "details/ie_irelease.hpp"
19 
20 namespace InferenceEngine {
21 
22 class NetworkNodeStats;
23 
24 /**
25  * @brief A shared pointer to the NetworkNodeStats object
26  */
27 using NetworkNodeStatsPtr = std::shared_ptr<NetworkNodeStats>;
28 
29 /**
30  * @brief A smart pointer to the NetworkNodeStats object
31  */
32 using NetworkNodeStatsWeakPtr = std::weak_ptr<NetworkNodeStats>;
33 
34 /**
35  * @brief A map of pairs: name of a layer and related statistics
36  */
37 using NetworkStatsMap = std::map<std::string, NetworkNodeStatsPtr>;
38 
39 /**
40  * @deprecated Migrate to IR v10 and use quantization approach with FakeQuantize
41  * @class ICNNNetworkStats
42  * @brief This is the interface to describe the NN topology scoring statistics
43  */
44 class INFERENCE_ENGINE_INTERNAL("Migrate to IR v10 and use quantization approach with FakeQuantize") ICNNNetworkStats : public details::IRelease {
45 public:
46  /**
47  * @brief Sets a map which contains layers with statistics
48  *
49  * @param stats A map which is set
50  * Abstract method
51  */
52  virtual void setNodesStats(const NetworkStatsMap& stats) = 0;
53  /**
54  * @brief Gets a map which contains layers with statistics
55  *
56  * Abstract method
57  * @return A NetworkStatsMap object
58  */
59  virtual const NetworkStatsMap& getNodesStats() const = 0;
60  /**
61  * @brief Checks if a container is empty
62  *
63  * Abstract method
64  * @return A bool value which shows whether a container is empty
65  */
66  virtual bool isEmpty() const = 0;
67 };
68 
69 /**
70  * @deprecated Migrate to IR v10 and use quantization approach with FakeQuantize
71  * @class NetworkNodeStats
72  * @brief This class implements a container which stores statistics for a layer
73  */
74 class INFERENCE_ENGINE_INTERNAL("Migrate to IR v10 and use quantization approach with FakeQuantize") NetworkNodeStats {
75 public:
76  /**
77  * @brief The constructor which creates NetworkNodeStats object
78  */
80  /**
81  * @brief The constructor which creates NetworkNodeStats object with filled statistics
82  *
83  * @param statCount The number of minimum/maximum values in statistics
84  */
85  explicit NetworkNodeStats(int statCount) {
86  float mn = (std::numeric_limits<float>::max)();
87  float mx = (std::numeric_limits<float>::min)();
88 
89  IE_SUPPRESS_DEPRECATED_START_WIN
90  for (int i = 0; i < statCount; i++) {
91  _minOutputs.push_back(mn);
92  _maxOutputs.push_back(mx);
93  }
94  IE_SUPPRESS_DEPRECATED_END_WIN
95  }
96 
97 public:
98  /**
99  * @brief Vector of floats which contains minimum values of layers activations
100  */
101  std::vector<float> _minOutputs;
102  /**
103  * @brief Vector of floats which contains maximum values of layers activations
104  */
105  std::vector<float> _maxOutputs;
106 };
107 
108 } // namespace InferenceEngine
NetworkNodeStats()
The constructor which creates NetworkNodeStats object.
Definition: ie_icnn_network_stats.hpp:79
Definition: cldnn_config.hpp:16
std::map< std::string, NetworkNodeStatsPtr > NetworkStatsMap
A map of pairs: name of a layer and related statistics.
Definition: ie_icnn_network_stats.hpp:37
std::shared_ptr< NetworkNodeStats > NetworkNodeStatsPtr
A shared pointer to the NetworkNodeStats object.
Definition: ie_icnn_network_stats.hpp:27
std::vector< float > _maxOutputs
Vector of floats which contains maximum values of layers activations.
Definition: ie_icnn_network_stats.hpp:105
std::weak_ptr< NetworkNodeStats > NetworkNodeStatsWeakPtr
A smart pointer to the NetworkNodeStats object.
Definition: ie_icnn_network_stats.hpp:32
This class implements a container which stores statistics for a layer.
Definition: ie_icnn_network_stats.hpp:74
A header file for the Inference Engine plugins destruction mechanism.
This is the interface to describe the NN topology scoring statistics.
Definition: ie_icnn_network_stats.hpp:44
NetworkNodeStats(int statCount)
The constructor which creates NetworkNodeStats object with filled statistics.
Definition: ie_icnn_network_stats.hpp:85
std::vector< float > _minOutputs
Vector of floats which contains minimum values of layers activations.
Definition: ie_icnn_network_stats.hpp:101