1 // Copyright (C) 2018-2019 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
94 // Single image layout (for mean image)
104 inline std::ostream & operator << (std::ostream &out, const Layout & p) {
106 #define PRINT_LAYOUT(name)\
107 case name : out << #name; break;
118 PRINT_LAYOUT(BLOCKED);
121 out << static_cast<int>(p);
129 * @struct InferenceEngineProfileInfo
130 * @brief Represents basic inference profiling information per layer.
131 * If the layer is executed using tiling, the sum time per each tile is indicated as the total execution time.
132 * Due to parallel execution, the total execution time for all layers might be greater than the total inference time.
134 struct InferenceEngineProfileInfo {
136 * @brief Defines the general status of the layer
146 * @brief The absolute time in microseconds that the layer ran (in total)
148 long long realTime_uSec;
150 * @brief The net host cpu time that the layer ran
155 * @brief An execution type of unit
157 char exec_type[256] = {};
160 * @brief A layer type
162 char layer_type[256] = {};
165 * @brief An execution index of the unit
167 unsigned execution_index;
173 * @brief This enum contains codes for all possible return values of the interface functions
175 enum StatusCode : int {
178 NOT_IMPLEMENTED = -2,
179 NETWORK_NOT_LOADED = -3,
180 PARAMETER_MISMATCH = -4,
184 * @brief exception not of std::exception derived type was thrown
188 RESULT_NOT_READY = -9,
190 INFER_NOT_STARTED = -11,
191 NETWORK_NOT_READ = -12
195 * @struct ResponseDesc
196 * @brief Represents detailed information for an error
198 struct ResponseDesc {
200 * @brief A character buffer that holds the detailed information for an error.
205 /** @brief This class represents StatusCode::GENERIC_ERROR exception */
206 class GeneralError : public std::logic_error
207 { using std::logic_error::logic_error; };
209 /** @brief This class represents StatusCode::NOT_IMPLEMENTED exception */
210 class NotImplemented : public std::logic_error
211 { using std::logic_error::logic_error; };
213 /** @brief This class represents StatusCode::NETWORK_NOT_LOADED exception */
214 class NetworkNotLoaded : public std::logic_error
215 { using std::logic_error::logic_error; };
217 /** @brief This class represents StatusCode::PARAMETER_MISMATCH exception */
218 class ParameterMismatch : public std::logic_error
219 { using std::logic_error::logic_error; };
221 /** @brief This class represents StatusCode::NOT_FOUND exception */
222 class NotFound : public std::logic_error
223 { using std::logic_error::logic_error; };
225 /** @brief This class represents StatusCode::OUT_OF_BOUNDS exception */
226 class OutOfBounds : public std::logic_error
227 { using std::logic_error::logic_error; };
229 /** @brief This class represents StatusCode::UNEXPECTED exception */
230 class Unexpected : public std::logic_error
231 { using std::logic_error::logic_error; };
233 /** @brief This class represents StatusCode::REQUEST_BUSY exception */
234 class RequestBusy : public std::logic_error
235 { using std::logic_error::logic_error; };
237 /** @brief This class represents StatusCode::RESULT_NOT_READY exception */
238 class ResultNotReady : public std::logic_error
239 { using std::logic_error::logic_error; };
241 /** @brief This class represents StatusCode::NOT_ALLOCATED exception */
242 class NotAllocated : public std::logic_error
243 { using std::logic_error::logic_error; };
245 /** @brief This class represents StatusCode::INFER_NOT_STARTED exception */
246 class InferNotStarted : public std::logic_error
247 { using std::logic_error::logic_error; };
248 } // namespace InferenceEngine
250 /** @brief This class represents StatusCode::NETWORK_NOT_READ exception */
251 class NetworkNotRead : public std::logic_error
252 { using std::logic_error::logic_error; };
255 #define __PRETTY_FUNCTION__ __FUNCSIG__
257 #define __PRETTY_FUNCTION__ __PRETTY_FUNCTION__