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