1 // Copyright (C) 2018 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
6 * @brief This is a header file with common inference engine definitions.
17 #include <details/ie_exception.hpp>
19 #include "ie_unicode.hpp"
21 namespace InferenceEngine {
23 * @brief Represents tensor size.
24 * The order is opposite to the order in Caffe*: (w,h,n,b) where the most frequently changing element in memory is first.
26 using SizeVector = std::vector<size_t>;
29 * @brief This class represents the generic layer.
34 * @brief A smart pointer to the CNNLayer
36 using CNNLayerPtr = std::shared_ptr<CNNLayer>;
38 * @brief A smart weak pointer to the CNNLayer
40 using CNNLayerWeakPtr = std::weak_ptr<CNNLayer>;
43 * @brief The main data representation node
48 * @brief Smart pointer to Data
50 using DataPtr = std::shared_ptr<Data>;
53 * @brief Smart pointer to constant Data
55 using CDataPtr = std::shared_ptr<const Data>;
58 * @brief Smart weak pointer to Data
60 using DataWeakPtr = std::weak_ptr<Data>;
64 * @brief The method holds the user values to enable binding of data per graph node.
74 * @brief Layouts that the inference engine supports
76 enum Layout : uint8_t {
77 ANY = 0, // "any" layout
91 // Single image layout (for mean image)
101 inline std::ostream & operator << (std::ostream &out, const Layout & p) {
103 #define PRINT_LAYOUT(name)\
104 case name : out << #name; break;
115 PRINT_LAYOUT(BLOCKED);
118 out << static_cast<int>(p);
126 * @struct InferenceEngineProfileInfo
127 * @brief Represents basic inference profiling information per layer.
128 * If the layer is executed using tiling, the sum time per each tile is indicated as the total execution time.
129 * Due to parallel execution, the total execution time for all layers might be greater than the total inference time.
131 struct InferenceEngineProfileInfo {
133 * @brief Defines the general status of the layer
143 * @brief The absolute time in microseconds that the layer ran (in total)
145 long long realTime_uSec;
147 * @brief The net host cpu time that the layer ran
152 * @brief An execution type of unit
154 char exec_type[256] = {};
157 * @brief A layer type
159 char layer_type[256] = {};
162 * @brief An execution index of the unit
164 unsigned execution_index;
170 * @brief This enum contains codes for all possible return values of the interface functions
172 enum StatusCode : int {
175 NOT_IMPLEMENTED = -2,
176 NETWORK_NOT_LOADED = -3,
177 PARAMETER_MISMATCH = -4,
181 * @brief exception not of std::exception derived type was thrown
185 RESULT_NOT_READY = -9,
187 INFER_NOT_STARTED = -11,
188 NETWORK_NOT_READ = -12
192 * @struct ResponseDesc
193 * @brief Represents detailed information for an error
195 struct ResponseDesc {
197 * @brief A character buffer that holds the detailed information for an error.
202 /** @brief This class represents StatusCode::GENERIC_ERROR exception */
203 class GeneralError : public std::logic_error
204 { using std::logic_error::logic_error; };
206 /** @brief This class represents StatusCode::NOT_IMPLEMENTED exception */
207 class NotImplemented : public std::logic_error
208 { using std::logic_error::logic_error; };
210 /** @brief This class represents StatusCode::NETWORK_NOT_LOADED exception */
211 class NetworkNotLoaded : public std::logic_error
212 { using std::logic_error::logic_error; };
214 /** @brief This class represents StatusCode::PARAMETER_MISMATCH exception */
215 class ParameterMismatch : public std::logic_error
216 { using std::logic_error::logic_error; };
218 /** @brief This class represents StatusCode::NOT_FOUND exception */
219 class NotFound : public std::logic_error
220 { using std::logic_error::logic_error; };
222 /** @brief This class represents StatusCode::OUT_OF_BOUNDS exception */
223 class OutOfBounds : public std::logic_error
224 { using std::logic_error::logic_error; };
226 /** @brief This class represents StatusCode::UNEXPECTED exception */
227 class Unexpected : public std::logic_error
228 { using std::logic_error::logic_error; };
230 /** @brief This class represents StatusCode::REQUEST_BUSY exception */
231 class RequestBusy : public std::logic_error
232 { using std::logic_error::logic_error; };
234 /** @brief This class represents StatusCode::RESULT_NOT_READY exception */
235 class ResultNotReady : public std::logic_error
236 { using std::logic_error::logic_error; };
238 /** @brief This class represents StatusCode::NOT_ALLOCATED exception */
239 class NotAllocated : public std::logic_error
240 { using std::logic_error::logic_error; };
242 /** @brief This class represents StatusCode::INFER_NOT_STARTED exception */
243 class InferNotStarted : public std::logic_error
244 { using std::logic_error::logic_error; };
245 } // namespace InferenceEngine
247 /** @brief This class represents StatusCode::NETWORK_NOT_READ exception */
248 class NetworkNotRead : public std::logic_error
249 { using std::logic_error::logic_error; };
252 #define __PRETTY_FUNCTION__ __FUNCSIG__
254 #define __PRETTY_FUNCTION__ __PRETTY_FUNCTION__