ie_c_api.h
Go to the documentation of this file.
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 /**
6  * @file ie_c_api.h
7  * C API of Inference Engine bridge unlocks using of OpenVINO Inference Engine
8  * library and all its plugins in native applications disabling usage
9  * of C++ API. The scope of API covers significant part of C++ API and includes
10  * an ability to read model from the disk, modify input and output information
11  * to correspond their runtime representation like data types or memory layout,
12  * load in-memory model to Inference Engine on different devices including
13  * heterogeneous and multi-device modes, manage memory where input and output
14  * is allocated and manage inference flow.
15 **/
16 
17 #ifndef IE_C_API_H
18 #define IE_C_API_H
19 
20 #include <stdint.h>
21 #include <stdio.h>
22 
23 #ifdef __cplusplus
24  #define INFERENCE_ENGINE_C_API_EXTERN extern "C"
25 #else
26  #define INFERENCE_ENGINE_C_API_EXTERN
27 #endif
28 
29 #if defined(__GNUC__) && (__GNUC__ < 4)
30  #define INFERENCE_ENGINE_C_API(...) INFERENCE_ENGINE_C_API_EXTERN __VA_ARGS__
31  #define IE_NODISCARD
32 #else
33  #if defined(_WIN32)
34  #define INFERENCE_ENGINE_C_API_CALLBACK __cdecl
35  #ifdef inference_engine_c_api_EXPORTS
36  #define INFERENCE_ENGINE_C_API(...) INFERENCE_ENGINE_C_API_EXTERN __declspec(dllexport) __VA_ARGS__ __cdecl
37  #else
38  #define INFERENCE_ENGINE_C_API(...) INFERENCE_ENGINE_C_API_EXTERN __declspec(dllimport) __VA_ARGS__ __cdecl
39  #endif
40  #define IE_NODISCARD
41  #else
42  #define INFERENCE_ENGINE_C_API(...) INFERENCE_ENGINE_C_API_EXTERN __attribute__((visibility("default"))) __VA_ARGS__
43  #define IE_NODISCARD __attribute__((warn_unused_result))
44  #endif
45 #endif
46 
47 #ifndef INFERENCE_ENGINE_C_API_CALLBACK
48  #define INFERENCE_ENGINE_C_API_CALLBACK
49 #endif
50 
51 typedef struct ie_core ie_core_t;
52 typedef struct ie_network ie_network_t;
53 typedef struct ie_executable ie_executable_network_t;
54 typedef struct ie_infer_request ie_infer_request_t;
55 typedef struct ie_blob ie_blob_t;
56 
57 /**
58  * @struct ie_version
59  * @brief Represents an API version information that reflects the set of supported features
60  */
61 typedef struct ie_version {
62  char *api_version; //!< A string representing Inference Engine version
63 } ie_version_t;
64 
65 /**
66  * @struct ie_core_version
67  * @brief Represents version information that describes devices and the inference engine runtime library
68  */
69 typedef struct ie_core_version {
70  size_t major; //!< A major version
71  size_t minor; //!< A minor version
72  const char *device_name; //!< A device name
73  const char *build_number; //!< A build number
74  const char *description; //!< A device description
76 
77 /**
78  * @struct ie_core_versions
79  * @brief Represents all versions information that describes all devices and the inference engine runtime library
80  */
81 typedef struct ie_core_versions {
82  ie_core_version_t *versions; //!< An array of device versions
83  size_t num_vers; //!< A number of versions in the array
85 
86 /**
87  * @struct ie_config
88  * @brief Represents configuration information that describes devices
89  */
90 typedef struct ie_config {
91  const char *name; //!< A configuration key
92  const char *value; //!< A configuration value
93  struct ie_config *next; //!< A pointer to the next configuration value
94 } ie_config_t;
95 
96 /**
97  * @struct ie_param
98  * @brief metric and config parameters.
99  */
100 typedef struct ie_param {
101  union {
102  char *params;
103  unsigned int number;
104  unsigned int range_for_async_infer_request[3];
105  unsigned int range_for_streams[2];
106  };
107 } ie_param_t;
108 
109 /**
110  * @struct ie_param_config
111  * @brief Represents configuration parameter information
112  */
113 typedef struct ie_param_config {
114  char *name;
115  ie_param_t *param;
117 
118 /**
119  * @struct desc
120  * @brief Represents detailed information for an error
121  */
122 typedef struct desc {
123  char msg[256]; //!< A description message
124 } desc_t;
125 
126 /**
127  * @struct dimensions
128  * @brief Represents dimensions for input or output data
129  */
130 typedef struct dimensions {
131  size_t ranks; //!< A runk representing a number of dimensions
132  size_t dims[8]; //!< An array of dimensions
133 } dimensions_t;
134 
135 /**
136  * @enum layout_e
137  * @brief Layouts that the inference engine supports
138  */
139 typedef enum {
140  ANY = 0, //!< "ANY" layout
141 
142  // I/O data layouts
143  NCHW = 1, //!< "NCHW" layout
144  NHWC = 2, //!< "NHWC" layout
145  NCDHW = 3, //!< "NCDHW" layout
146  NDHWC = 4, //!< "NDHWC" layout
147 
148  // weight layouts
149  OIHW = 64, //!< "OIHW" layout
150 
151  // Scalar
152  SCALAR = 95, //!< "SCALAR" layout
153 
154  // bias layouts
155  C = 96, //!< "C" layout
156 
157  // Single image layout (for mean image)
158  CHW = 128, //!< "CHW" layout
159 
160  // 2D
161  HW = 192, //!< "HW" layout
162  NC = 193, //!< "NC" layout
163  CN = 194, //!< "CN" layout
164 
165  BLOCKED = 200, //!< "BLOCKED" layout
166 } layout_e;
167 
168 /**
169  * @enum precision_e
170  * @brief Precisions that the inference engine supports
171  */
172 typedef enum {
173  UNSPECIFIED = 255, /**< Unspecified value. Used by default */
174  MIXED = 0, /**< Mixed value. Can be received from network. No applicable for tensors */
175  FP32 = 10, /**< 32bit floating point value */
176  FP16 = 11, /**< 16bit floating point value */
177  FP64 = 13, /**< 64bit floating point value */
178  Q78 = 20, /**< 16bit specific signed fixed point precision */
179  I16 = 30, /**< 16bit signed integer value */
180  U4 = 39, /**< 4bit unsigned integer value */
181  U8 = 40, /**< 8bit unsigned integer value */
182  I4 = 49, /**< 4bit signed integer value */
183  I8 = 50, /**< 8bit signed integer value */
184  U16 = 60, /**< 16bit unsigned integer value */
185  I32 = 70, /**< 32bit signed integer value */
186  I64 = 72, /**< 64bit signed integer value */
187  U64 = 73, /**< 64bit unsigned integer value */
188  U32 = 74, /**< 32bit unsigned integer value */
189  BIN = 71, /**< 1bit integer value */
190  CUSTOM = 80 /**< custom precision has it's own name and size of elements */
192 
193 /**
194  * @struct tensor_desc
195  * @brief Represents detailed information for a tensor
196  */
197 typedef struct tensor_desc {
198  layout_e layout;
199  dimensions_t dims;
200  precision_e precision;
201 } tensor_desc_t;
202 
203 /**
204  * @enum colorformat_e
205  * @brief Extra information about input color format for preprocessing
206  */
207 typedef enum {
208  RAW = 0u, //!< Plain blob (default), no extra color processing required
209  RGB, //!< RGB color format
210  BGR, //!< BGR color format, default in DLDT
211  RGBX, //!< RGBX color format with X ignored during inference
212  BGRX, //!< BGRX color format with X ignored during inference
213  NV12, //!< NV12 color format represented as compound Y+UV blob
214  I420, //!< I420 color format represented as compound Y+U+V blob
215 } colorformat_e;
216 
217 /**
218  * @enum resize_alg_e
219  * @brief Represents the list of supported resize algorithms.
220  */
221 typedef enum {
222  NO_RESIZE = 0, //!< "No resize" mode
223  RESIZE_BILINEAR, //!< "Bilinear resize" mode
224  RESIZE_AREA //!< "Area resize" mode
226 
227 /**
228  * @enum IEStatusCode
229  * @brief This enum contains codes for all possible return values of the interface functions
230  */
231 typedef enum {
232  OK = 0,
233  GENERAL_ERROR = -1,
234  NOT_IMPLEMENTED = -2,
235  NETWORK_NOT_LOADED = -3,
236  PARAMETER_MISMATCH = -4,
237  NOT_FOUND = -5,
238  OUT_OF_BOUNDS = -6,
239  /*
240  * @brief exception not of std::exception derived type was thrown
241  */
242  UNEXPECTED = -7,
243  REQUEST_BUSY = -8,
244  RESULT_NOT_READY = -9,
245  NOT_ALLOCATED = -10,
246  INFER_NOT_STARTED = -11,
247  NETWORK_NOT_READ = -12,
248  INFER_CANCELLED = -13,
249 } IEStatusCode;
250 
251 /**
252  * @struct roi_t
253  * @brief This structure describes roi data.
254  */
255 typedef struct roi {
256  size_t id; //!< ID of a roi
257  size_t posX; //!< W upper left coordinate of roi
258  size_t posY; //!< H upper left coordinate of roi
259  size_t sizeX; //!< W size of roi
260  size_t sizeY; //!< H size of roi
261 } roi_t;
262 
263 /**
264  * @struct input_shape
265  * @brief Represents shape for input data
266  */
267 typedef struct input_shape {
268  char *name;
269  dimensions_t shape;
270 } input_shape_t;
271 
272 /**
273  * @struct input_shapes
274  * @brief Represents shapes for all input data
275  */
276 typedef struct input_shapes {
277  input_shape_t *shapes;
278  size_t shape_num;
280 
281 /**
282  * @struct ie_blob_buffer
283  * @brief Represents copied data from the given blob.
284  */
285 typedef struct ie_blob_buffer {
286  union {
287  void *buffer; //!< buffer can be written
288  const void *cbuffer; //!< cbuffer is read-only
289  };
291 
292 /**
293  * @struct ie_complete_call_back
294  * @brief Completion callback definition about the function and args
295  */
296 typedef struct ie_complete_call_back {
297  void (INFERENCE_ENGINE_C_API_CALLBACK *completeCallBackFunc)(void *args);
298  void *args;
300 
301 /**
302  * @struct ie_available_devices
303  * @brief Represent all available devices.
304  */
305 typedef struct ie_available_devices {
306  char **devices;
307  size_t num_devices;
309 
310 /**
311  * @brief Returns number of version that is exported. Use the ie_version_free() to free memory.
312  * @return Version number of the API.
313  */
314 INFERENCE_ENGINE_C_API(ie_version_t) ie_c_api_version(void);
315 
316 /**
317  * @brief Release the memory allocated by ie_c_api_version.
318  * @param version A pointer to the ie_version_t to free memory.
319  */
320 INFERENCE_ENGINE_C_API(void) ie_version_free(ie_version_t *version);
321 
322 /**
323  * @brief Release the memory allocated by ie_param_t.
324  * @param param A pointer to the ie_param_t to free memory.
325  */
326 INFERENCE_ENGINE_C_API(void) ie_param_free(ie_param_t *param);
327 
328 // Core
329 
330 /**
331  * @defgroup Core Core
332  * Set of functions dedicated to working with registered plugins and loading
333  * network to the registered devices.
334  * @{
335  */
336 
337 /**
338  * @brief Constructs Inference Engine Core instance using XML configuration file with devices description.
339  * See RegisterPlugins for more details. Use the ie_core_free() method to free memory.
340  * @ingroup Core
341  * @param xml_config_file A path to .xml file with devices to load from. If XML configuration file is not specified,
342  * then default Inference Engine devices are loaded from the default plugin.xml file.
343  * @param core A pointer to the newly created ie_core_t.
344  * @return Status code of the operation: OK(0) for success.
345  */
346 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_create(const char *xml_config_file, ie_core_t **core);
347 
348 /**
349  * @brief Releases memory occupied by core.
350  * @ingroup Core
351  * @param core A pointer to the core to free memory.
352  */
353 INFERENCE_ENGINE_C_API(void) ie_core_free(ie_core_t **core);
354 
355 /**
356  * @brief Gets version information of the device specified. Use the ie_core_versions_free() method to free memory.
357  * @ingroup Core
358  * @param core A pointer to ie_core_t instance.
359  * @param device_name Name to identify device.
360  * @param versions A pointer to versions corresponding to device_name.
361  * @return Status code of the operation: OK(0) for success.
362  */
363 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_get_versions(const ie_core_t *core, const char *device_name, ie_core_versions_t *versions);
364 
365 /**
366  * @brief Releases memory occupied by ie_core_versions.
367  * @ingroup Core
368  * @param vers A pointer to the ie_core_versions to free memory.
369  */
370 INFERENCE_ENGINE_C_API(void) ie_core_versions_free(ie_core_versions_t *vers);
371 
372 /**
373  * @brief Reads the model from the .xml and .bin files of the IR. Use the ie_network_free() method to free memory.
374  * @ingroup Core
375  * @param core A pointer to ie_core_t instance.
376  * @param xml .xml file's path of the IR.
377  * @param weights_file .bin file's path of the IR, if path is empty, will try to read bin file with the same name as xml and
378  * if bin file with the same name was not found, will load IR without weights.
379  * @param network A pointer to the newly created network.
380  * @return Status code of the operation: OK(0) for success.
381  */
382 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_read_network(ie_core_t *core, const char *xml, const char *weights_file, ie_network_t **network);
383 
384 /**
385  * @brief Reads the model from an xml string and a blob of the bin part of the IR. Use the ie_network_free() method to free memory.
386  * @ingroup Core
387  * @param core A pointer to ie_core_t instance.
388  * @param xml_content Xml content of the IR.
389  * @param xml_content_size Number of bytes in the xml content of the IR.
390  * @param weight_blob Blob containing the bin part of the IR.
391  * @param network A pointer to the newly created network.
392  * @return Status code of the operation: OK(0) for success.
393  */
394 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_read_network_from_memory(ie_core_t *core, const uint8_t *xml_content, size_t xml_content_size,
395  const ie_blob_t *weight_blob, ie_network_t **network);
396 
397 /**
398  * @brief Creates an executable network from a network object. Users can create as many networks as they need and use
399  * them simultaneously (up to the limitation of the hardware resources). Use the ie_exec_network_free() method to free memory.
400  * @ingroup Core
401  * @param core A pointer to ie_core_t instance.
402  * @param network A pointer to ie_network instance.
403  * @param device_name Name of device to load network to.
404  * @param config Device configuration.
405  * @param exe_network A pointer to the newly created executable network.
406  * @return Status code of the operation: OK(0) for success.
407  */
408 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_load_network(ie_core_t *core, const ie_network_t *network, const char *device_name, \
409  const ie_config_t *config, ie_executable_network_t **exe_network);
410 
411 /**
412 * @brief Reads model and creates an executable network from IR or ONNX file. Users can create as many networks as they need and use
413 * them simultaneously (up to the limitation of the hardware resources). Use the ie_exec_network_free() method to free memory.
414 * @ingroup Core
415 * @param core A pointer to ie_core_t instance.
416 * @param xml .xml file's path of the IR. Weights file name will be calculated automatically
417 * @param device_name Name of device to load network to.
418 * @param config Device configuration.
419 * @param exe_network A pointer to the newly created executable network.
420 * @return Status code of the operation: OK(0) for success.
421 */
422 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_load_network_from_file(ie_core_t *core, const char *xml, const char *device_name, \
423  const ie_config_t *config, ie_executable_network_t **exe_network);
424 
425 /**
426  * @brief Sets configuration for device.
427  * @ingroup Core
428  * @param core A pointer to ie_core_t instance.
429  * @param ie_core_config Device configuration.
430  * @param device_name An optional name of a device. If device name is not specified,
431  * the config is set for all the registered devices.
432  * @return Status code of the operation: OK(0) for success.
433  */
434 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_set_config(ie_core_t *core, const ie_config_t *ie_core_config, const char *device_name);
435 
436 /**
437  * @brief Registers a new device and a plugin which implement this device inside Inference Engine.
438  * @ingroup Core
439  * @param core A pointer to ie_core_t instance.
440  * @param plugin_name A name of a plugin. Depending on a platform, plugin_name is wrapped with
441  * a shared library suffix and a prefix to identify a full name of the library.
442  * @param device_name A device name to register plugin for. If not specified, the method registers
443  * a plugin with the default name.
444  * @return Status code of the operation: OK(0) for success.
445  */
446 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_register_plugin(ie_core_t *core, const char *plugin_name, const char *device_name);
447 
448 /**
449  * @brief Registers plugins specified in an ".xml" configuration file.
450  * @ingroup Core
451  * @param core A pointer to ie_core_t instance.
452  * @param xml_config_file A full path to ".xml" file containing plugins configuration.
453  * @return Status code of the operation: OK(0) for success.
454  */
455 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_register_plugins(ie_core_t *core, const char *xml_config_file);
456 
457 /**
458  * @brief Unregisters a plugin with a specified device name.
459  * @ingroup Core
460  * @param core A pointer to ie_core_t instance.
461  * @param device_name A device name of the device to unregister.
462  * @return Status code of the operation: OK(0) for success.
463  */
464 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_unregister_plugin(ie_core_t *core, const char *device_name);
465 
466 /**
467  * @brief Loads extension library to the device with a specified device name.
468  * @ingroup Core
469  * @param core A pointer to ie_core_t instance.
470  * @param extension_path Path to the extensions library file to load to a device.
471  * @param device_name A device name of a device to load the extensions to.
472  * @return Status code of the operation: OK(0) for success.
473  */
474 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_add_extension(ie_core_t *core, const char *extension_path, const char *device_name);
475 
476 /**
477  * @brief Gets general runtime metric for dedicated hardware. The method is needed to request common device properties
478  * which are executable network agnostic. It can be device name, temperature, other devices-specific values.
479  * @ingroup Core
480  * @param core A pointer to ie_core_t instance.
481  * @param device_name A name of a device to get a metric value.
482  * @param metric_name A metric name to request.
483  * @param param_result A metric value corresponding to the metric_name.
484  * @return Status code of the operation: OK(0) for success.
485  */
486 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_get_metric(const ie_core_t *core, const char *device_name, const char *metric_name, ie_param_t *param_result);
487 
488 /**
489  * @brief Gets configuration dedicated to device behaviour. The method is targeted to extract information
490  * which can be set via SetConfig method.
491  * @ingroup Core
492  * @param core A pointer to ie_core_t instance.
493  * @param device_name A name of a device to get a configuration value.
494  * @param config_name Name of a configuration.
495  * @param param_result A configuration value corresponding to the config_name.
496  * @return Status code of the operation: OK(0) for success.
497  */
498 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_get_config(const ie_core_t *core, const char *device_name, const char *config_name, ie_param_t *param_result);
499 
500 /**
501  * @brief Gets available devices for neural network inference.
502  * @ingroup Core
503  * @param core A pointer to ie_core_t instance.
504  * @param avai_devices The devices are returned as { CPU, FPGA.0, FPGA.1, MYRIAD }
505  * If there more than one device of specific type, they are enumerated with .# suffix
506  * @return Status code of the operation: OK(0) for success.
507  */
508 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_core_get_available_devices(const ie_core_t *core, ie_available_devices_t *avai_devices);
509 
510 /**
511  * @brief Releases memory occpuied by ie_available_devices_t
512  * @ingroup Core
513  * @param avai_devices A pointer to the ie_available_devices_t to free memory.
514  */
515 INFERENCE_ENGINE_C_API(void) ie_core_available_devices_free(ie_available_devices_t *avai_devices);
516 
517 /** @} */ // end of Core
518 
519 // ExecutableNetwork
520 
521 /**
522  * @defgroup ExecutableNetwork ExecutableNetwork
523  * Set of functions representing of neural networks been loaded to device.
524  * @{
525  */
526 
527 /**
528  * @brief Releases memory occupied by ExecutableNetwork.
529  * @ingroup ExecutableNetwork
530  * @param ie_exec_network A pointer to the ExecutableNetwork to free memory.
531  */
532 INFERENCE_ENGINE_C_API(void) ie_exec_network_free(ie_executable_network_t **ie_exec_network);
533 
534 /**
535  * @brief Creates an inference request instance used to infer the network. The created request has allocated input
536  * and output blobs (that can be changed later). Use the ie_infer_request_free() method to free memory.
537  * @ingroup ExecutableNetwork
538  * @param ie_exec_network A pointer to ie_executable_network_t instance.
539  * @param request A pointer to the newly created ie_infer_request_t instance
540  * @return Status code of the operation: OK(0) for success.
541  */
542 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_exec_network_create_infer_request(ie_executable_network_t *ie_exec_network, ie_infer_request_t **request);
543 
544 /**
545  * @brief Gets general runtime metric for an executable network. It can be network name, actual device ID on which executable network is running
546  * or all other properties which cannot be changed dynamically.
547  * @ingroup ExecutableNetwork
548  * @param ie_exec_network A pointer to ie_executable_network_t instance.
549  * @param metric_name A metric name to request.
550  * @param param_result A metric value corresponding to the metric_name.
551  * @return Status code of the operation: OK(0) for success.
552  */
553 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_exec_network_get_metric(const ie_executable_network_t *ie_exec_network, \
554  const char *metric_name, ie_param_t *param_result);
555 
556 /**
557  * @brief Sets configuration for current executable network. Currently, the method can be used
558  * when the network run on the Multi device and the configuration parameter is only can be "MULTI_DEVICE_PRIORITIES"
559  * @ingroup ExecutableNetwork
560  * @param ie_exec_network A pointer to ie_executable_network_t instance.
561  * @param param_config A pointer to device configuration..
562  * @return Status code of the operation: OK(0) for success.
563  */
564 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_exec_network_set_config(ie_executable_network_t *ie_exec_network, const ie_config_t *param_config);
565 
566 /**
567  * @brief Gets configuration for current executable network. The method is responsible to
568  * extract information which affects executable network execution.
569  * @ingroup ExecutableNetwork
570  * @param ie_exec_network A pointer to ie_executable_network_t instance.
571  * @param metric_config A configuration parameter name to request.
572  * @param param_result A configuration value corresponding to a configuration parameter name.
573  * @return Status code of the operation: OK(0) for success.
574  */
575 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_exec_network_get_config(const ie_executable_network_t *ie_exec_network, \
576  const char *metric_config, ie_param_t *param_result);
577 
578 /** @} */ // end of ExecutableNetwork
579 
580 // InferRequest
581 
582 /**
583  * @defgroup InferRequest InferRequest
584  * Set of functions responsible for dedicated inference for certain
585  * ExecutableNetwork.
586  * @{
587  */
588 
589 /**
590  * @brief Releases memory occupied by ie_infer_request_t instance.
591  * @ingroup InferRequest
592  * @param infer_request A pointer to the ie_infer_request_t to free memory.
593  */
594 INFERENCE_ENGINE_C_API(void) ie_infer_request_free(ie_infer_request_t **infer_request);
595 
596 /**
597  * @brief Gets input/output data for inference
598  * @ingroup InferRequest
599  * @param infer_request A pointer to ie_infer_request_t instance.
600  * @param name Name of input or output blob.
601  * @param blob A pointer to input or output blob. The type of Blob must match the network input precision and size.
602  * @return Status code of the operation: OK(0) for success.
603  */
604 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_infer_request_get_blob(ie_infer_request_t *infer_request, const char *name, ie_blob_t **blob);
605 
606 /**
607  * @brief Sets input/output data to inference.
608  * @ingroup InferRequest
609  * @param infer_request A pointer to ie_infer_request_t instance.
610  * @param name Name of input or output blob.
611  * @param blob Reference to input or output blob. The type of a blob must match the network input precision and size.
612  * @return Status code of the operation: OK(0) for success.
613  */
614 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_infer_request_set_blob(ie_infer_request_t *infer_request, const char *name, const ie_blob_t *blob);
615 
616 /**
617  * @brief Starts synchronous inference of the infer request and fill outputs.
618  * @ingroup InferRequest
619  * @param infer_request A pointer to ie_infer_request_t instance.
620  * @return Status code of the operation: OK(0) for success.
621  */
622 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_infer_request_infer(ie_infer_request_t *infer_request);
623 
624 /**
625  * @brief Starts asynchronous inference of the infer request and fill outputs.
626  * @ingroup InferRequest
627  * @param infer_request A pointer to ie_infer_request_t instance.
628  * @return Status code of the operation: OK(0) for success.
629  */
630 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_infer_request_infer_async(ie_infer_request_t *infer_request);
631 
632 /**
633  * @brief Sets a callback function that will be called on success or failure of asynchronous request
634  * @ingroup InferRequest
635  * @param infer_request A pointer to ie_infer_request_t instance.
636  * @param callback A function to be called.
637  * @return Status code of the operation: OK(0) for success.
638  */
639 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_infer_set_completion_callback(ie_infer_request_t *infer_request, ie_complete_call_back_t *callback);
640 
641 /**
642  * @brief Waits for the result to become available. Blocks until specified timeout elapses or the result becomes available, whichever comes first.
643  * @ingroup InferRequest
644  * @param infer_request A pointer to ie_infer_request_t instance.
645  * @param timeout Maximum duration in milliseconds to block for
646  * @note There are special cases when timeout is equal some value of the WaitMode enum:
647  * * 0 - Immediately returns the inference status. It does not block or interrupt execution.
648  * * -1 - waits until inference result becomes available
649  * @return Status code of the operation: OK(0) for success.
650  */
651 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_infer_request_wait(ie_infer_request_t *infer_request, const int64_t timeout);
652 
653 /**
654  * @brief Sets new batch size for certain infer request when dynamic batching is enabled in executable network that created this request.
655  * @ingroup InferRequest
656  * @param infer_request A pointer to ie_infer_request_t instance.
657  * @param size New batch size to be used by all the following inference calls for this request.
658  * @return Status code of the operation: OK(0) for success.
659  */
660 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_infer_request_set_batch(ie_infer_request_t *infer_request, const size_t size);
661 
662 /** @} */ // end of InferRequest
663 
664 // Network
665 
666 /**
667  * @defgroup Network Network
668  * Set of functions managing network been read from the IR before loading
669  * of it to the device.
670  * @{
671  */
672 
673 /**
674  * @brief When network is loaded into the Infernece Engine, it is not required anymore and should be released
675  * @ingroup Network
676  * @param network The pointer to the instance of the ie_network_t to free.
677  */
678 INFERENCE_ENGINE_C_API(void) ie_network_free(ie_network_t **network);
679 
680 /**
681  * @brief Get name of network.
682  * @ingroup Network
683  * @param network A pointer to the instance of the ie_network_t to get a name from.
684  * @param name Name of the network.
685  * @return Status code of the operation: OK(0) for success.
686  */
687 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_name(const ie_network_t *network, char **name);
688 
689 /**
690  * @brief Gets number of inputs for the network.
691  * @ingroup Network
692  * @param network A pointer to the instance of the ie_network_t to get number of input information.
693  * @param size_result A number of the instance's input information.
694  * @return Status code of the operation: OK(0) for success.
695  */
696 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_inputs_number(const ie_network_t *network, size_t *size_result);
697 
698 /**
699  * @brief Gets name corresponding to the "number". Use the ie_network_name_free() method to free memory.
700  * @ingroup Network
701  * @param network A pointer to theinstance of the ie_network_t to get input information.
702  * @param number An id of input information .
703  * @param name Input name corresponding to the number.
704  * @return status Status code of the operation: OK(0) for success.
705  */
706 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_input_name(const ie_network_t *network, size_t number, char **name);
707 
708 /**
709  * @brief Gets a precision of the input data provided by user.
710  * @ingroup Network
711  * @param network A pointer to ie_network_t instance.
712  * @param input_name Name of input data.
713  * @param prec_result A pointer to the precision used for input blob creation.
714  * @return Status code of the operation: OK(0) for success.
715  */
716 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_input_precision(const ie_network_t *network, const char *input_name, precision_e *prec_result);
717 
718 /**
719  * @brief Changes the precision of the input data provided by the user.
720  * This function should be called before loading the network to the device.
721  * @ingroup Network
722  * @param network A pointer to ie_network_t instance.
723  * @param input_name Name of input data.
724  * @param p A new precision of the input data to set (eg. precision_e.FP16).
725  * @return Status code of the operation: OK(0) for success.
726  */
727 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_set_input_precision(ie_network_t *network, const char *input_name, const precision_e p);
728 
729 /**
730  * @brief Gets a layout of the input data.
731  * @ingroup Network
732  * @param network A pointer to ie_network_t instance.
733  * @param input_name Name of input data.
734  * @param layout_result A pointer to the layout used for input blob creation.
735  * @return Status code of the operation: OK(0) for success.
736  */
737 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_input_layout(const ie_network_t *network, const char *input_name, layout_e *layout_result);
738 
739 /**
740  * @brief Changes the layout of the input data named "input_name".
741  * This function should be called before loading the network to the device.
742  * @ingroup Network
743  * @param network A pointer to ie_network_t instance.
744  * @param input_name Name of input data.
745  * @param l A new layout of the input data to set.
746  * @return Status code of the operation: OK(0) for success.
747  */
748 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_set_input_layout(ie_network_t *network, const char *input_name, const layout_e l);
749 
750 /**
751  * @brief Gets dimensions/shape of the input data with reversed order.
752  * @ingroup Network
753  * @param network A pointer to ie_network_t instance.
754  * @param input_name Name of input data.
755  * @param dims_result A pointer to the dimensions used for input blob creation.
756  * @return Status code of the operation: OK(0) for success.
757  */
758 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_input_dims(const ie_network_t *network, const char *input_name, dimensions_t *dims_result);
759 
760 /**
761  * @brief Gets pre-configured resize algorithm.
762  * @ingroup Network
763  * @param network A pointer to ie_network_t instance.
764  * @param input_name Name of input data.
765  * @param resize_alg_result The pointer to the resize algorithm used for input blob creation.
766  * @return Status code of the operation: OK(0) for success.
767  */
768 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_input_resize_algorithm(const ie_network_t *network, const char *input_name, resize_alg_e *resize_alg_result);
769 
770 /**
771  * @brief Sets resize algorithm to be used during pre-processing
772  * @ingroup Network
773  * @param network A pointer to ie_network_t instance.
774  * @param input_name Name of input data.
775  * @param resize_algo Resize algorithm.
776  * @return Status code of the operation: OK(0) for success.
777  */
778 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_set_input_resize_algorithm(ie_network_t *network, const char *input_name, const resize_alg_e resize_algo);
779 
780 /**
781  * @brief Gets color format of the input data.
782  * @ingroup Network
783  * @param network A pointer to ie_network_t instance.
784  * @param input_name Name of input data.
785  * @param colformat_result The pointer to the color format used for input blob creation.
786  * @return Status code of the operation: OK(0) for success.
787  */
788 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_color_format(const ie_network_t *network, const char *input_name, colorformat_e *colformat_result);
789 
790 /**
791  * @brief Changes the color format of the input data.
792  * @ingroup Network
793  * @param network A pointer to ie_network_t instance.
794  * @param input_name Name of input data.
795  * @param color_format Color format of the input data.
796  * @return Status code of the operation: OK(0) for success.
797  */
798 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_set_color_format(ie_network_t *network, const char *input_name, const colorformat_e color_format);
799 
800 /**
801  * @brief Helper method collect all input shapes with input names of corresponding input data.
802  * Use the ie_network_input_shapes_free() method to free memory.
803  * @ingroup Network
804  * @param network A pointer to the instance of the ie_network_t to get input shapes.
805  * @param shapes A pointer to the input_shapes.
806  * @return Status code of the operation: OK(0) for success.
807  */
808 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_input_shapes(ie_network_t *network, input_shapes_t *shapes);
809 
810 /**
811  * @brief Run shape inference with new input shapes for the network.
812  * @ingroup Network
813  * @param network A pointer to the instance of the ie_network_t to reshape.
814  * @param shapes A new input shapes to set for the network.
815  * @return Status code of the operation: OK(0) for success.
816  */
817 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_reshape(ie_network_t *network, const input_shapes_t shapes);
818 
819 /**
820  * @brief Gets number of output for the network.
821  * @ingroup Network
822  * @param network A pointer to the instance of the ie_network_t to get number of output information.
823  * @param size_result A number of the network's output information.
824  * @return Status code of the operation: OK(0) for success.
825  */
826 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_outputs_number(const ie_network_t *network, size_t *size_result);
827 
828 /**
829  * @brief Gets name corresponding to the "number". Use the ie_network_name_free() method to free memory.
830  * @ingroup Network
831  * @param network A pointer to theinstance of the ie_network_t to get output information.
832  * @param number An id of output information .
833  * @param name Output name corresponding to the number.
834  * @return Status code of the operation: OK(0) for success.
835  */
836 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_output_name(const ie_network_t *network, const size_t number, char **name);
837 
838 /**
839  * @brief Gets a precision of the output data named "output_name".
840  * @ingroup Network
841  * @param network A pointer to ie_network_t instance.
842  * @param output_name Name of output data.
843  * @param prec_result A pointer to the precision used for output blob creation.
844  * @return Status code of the operation: OK(0) for success.
845  */
846 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_output_precision(const ie_network_t *network, const char *output_name, precision_e *prec_result);
847 
848 /**
849  * @brief Changes the precision of the output data named "output_name".
850  * @ingroup Network
851  * @param network A pointer to ie_network_t instance.
852  * @param output_name Name of output data.
853  * @param p A new precision of the output data to set (eg. precision_e.FP16).
854  * @return Status code of the operation: OK(0) for success.
855  */
856 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_set_output_precision(ie_network_t *network, const char *output_name, const precision_e p);
857 
858 /**
859  * @brief Gets a layout of the output data.
860  * @ingroup Network
861  * @param network A pointer to ie_network_t instance.
862  * @param output_name Name of output data.
863  * @param layout_result A pointer to the layout used for output blob creation.
864  * @return Status code of the operation: OK(0) for success.
865  */
866 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_output_layout(const ie_network_t *network, const char *output_name, layout_e *layout_result);
867 
868 /**
869  * @brief Changes the layout of the output data named "output_name".
870  * @ingroup Network
871  * @param network A pointer to ie_network_t instance.
872  * @param output_name Name of output data.
873  * @param l A new layout of the output data to set.
874  * @return Status code of the operation: OK(0) for success.
875  */
876 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_set_output_layout(ie_network_t *network, const char *output_name, const layout_e l);
877 
878 /**
879  * @brief Gets dimensions/shape of the output data with reversed order.
880  * @ingroup Network
881  * @param network A pointer to ie_network_t instance.
882  * @param output_name Name of output data.
883  * @param dims_result A pointer to the dimensions used for output blob creation.
884  * @return Status code of the operation: OK(0) for success.
885  */
886 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_network_get_output_dims(const ie_network_t *network, const char *output_name, dimensions_t *dims_result);
887 
888 /**
889  * @brief Releases memory occupied by input_shapes.
890  * @ingroup Network
891  * @param inputShapes A pointer to the input_shapes to free memory.
892  */
893 INFERENCE_ENGINE_C_API(void) ie_network_input_shapes_free(input_shapes_t *inputShapes);
894 
895 /**
896  * @brief Releases momory occupied by input_name or output_name.
897  * @ingroup Network
898  * @param name A pointer to the input_name or output_name to free memory.
899  */
900 INFERENCE_ENGINE_C_API(void) ie_network_name_free(char **name);
901 
902 /** @} */ // end of InferRequest
903 
904 // Blob
905 
906 /**
907  * @defgroup Blob Blob
908  * Set of functions allowing to research memory from infer requests or make new
909  * memory objects to be passed to InferRequests.
910  * @{
911  */
912 
913 /**
914  * @brief Creates a blob with the specified dimensions, layout and to allocate memory.
915  * @ingroup Blob
916  * @param tensorDesc Tensor descriptor for Blob creation.
917  * @param blob A pointer to the newly created blob.
918  * @return Status code of the operation: OK(0) for success.
919  */
920 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_make_memory(const tensor_desc_t *tensorDesc, ie_blob_t **blob);
921 
922 /**
923  * @brief Creates a blob with the given tensor descriptor from the pointer to the pre-allocated memory.
924  * @ingroup Blob
925  * @param tensorDesc Tensor descriptor for Blob creation.
926  * @param ptr Pointer to the pre-allocated memory.
927  * @param size Length of the pre-allocated array.
928  * @param blob A pointer to the newly created blob.
929  * @return Status code of the operation: OK(0) for success.
930  */
931 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_make_memory_from_preallocated(const tensor_desc_t *tensorDesc, void *ptr, size_t size, ie_blob_t **blob);
932 
933 /**
934  * @brief Creates a blob describing given roi_t instance based on the given blob with pre-allocated memory.
935  * @ingroup Blob
936  * @param inputBlob original blob with pre-allocated memory.
937  * @param roi A roi_tinstance inside of the original blob.
938  * @param blob A pointer to the newly created blob.
939  * @return Status code of the operation: OK(0) for success.
940  */
941 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_make_memory_with_roi(const ie_blob_t *inputBlob, const roi_t *roi, ie_blob_t **blob);
942 
943 /**
944  * @brief Creates a NV12 blob from two planes Y and UV.
945  * @ingroup Blob
946  * @param y A pointer to the ie_blob_t instance that represents Y plane in NV12 color format.
947  * @param uv A pointer to the ie_blob_t instance that represents UV plane in NV12 color format.
948  * @param nv12Blob A pointer to the newly created blob.
949  * @return Status code of the operation: OK(0) for success.
950 */
951 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_make_memory_nv12(const ie_blob_t *y, const ie_blob_t *uv, ie_blob_t **nv12Blob);
952 
953 /**
954  * @brief Creates I420 blob from three planes Y, U and V.
955  * @ingroup Blob
956  * @param y A pointer to the ie_blob_t instance that represents Y plane in I420 color format.
957  * @param u A pointer to the ie_blob_t instance that represents U plane in I420 color format.
958  * @param v A pointer to the ie_blob_t instance that represents V plane in I420 color format.
959  * @param i420Blob A pointer to the newly created blob.
960  * @return Status code of the operation: OK(0) for success.
961 */
962 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_make_memory_i420(const ie_blob_t *y, const ie_blob_t *u, const ie_blob_t *v, ie_blob_t **i420Blob);
963 
964 /**
965  * @brief Gets the total number of elements, which is a product of all the dimensions.
966  * @ingroup Blob
967  * @param blob A pointer to the blob.
968  * @param size_result The total number of elements.
969  * @return Status code of the operation: OK(0) for success.
970  */
971 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_size(ie_blob_t *blob, int *size_result);
972 
973 /**
974  * @brief Gets the size of the current Blob in bytes.
975  * @ingroup Blob
976  * @param blob A pointer to the blob.
977  * @param bsize_result The size of the current blob in bytes.
978  * @return Status code of the operation: OK(0) for success.
979  */
980 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_byte_size(ie_blob_t *blob, int *bsize_result);
981 
982 /**
983  * @brief Releases previously allocated data
984  * @ingroup Blob
985  * @param blob A pointer to the blob to free memory.
986  */
987 INFERENCE_ENGINE_C_API(void) ie_blob_deallocate(ie_blob_t **blob);
988 
989 /**
990  * @brief Gets access to the allocated memory .
991  * @ingroup Blob
992  * @param blob A pointer to the blob.
993  * @param blob_buffer A pointer to the copied data from the given blob.
994  * @return Status code of the operation: OK(0) for success.
995  */
996 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_get_buffer(const ie_blob_t *blob, ie_blob_buffer_t *blob_buffer);
997 
998 /**
999  * @brief Gets read-only access to the allocated memory.
1000  * @ingroup Blob
1001  * @param blob A pointer to the blob.
1002  * @param blob_cbuffer A pointer to the coped data from the given pointer to the blob and the data is read-only.
1003  * @return Status code of the operation: OK(0) for success
1004  */
1005 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_get_cbuffer(const ie_blob_t *blob, ie_blob_buffer_t *blob_cbuffer);
1006 
1007 /**
1008  * @brief Gets dimensions of blob's tensor.
1009  * @ingroup Blob
1010  * @param blob A pointer to the blob.
1011  * @param dims_result A pointer to the dimensions of blob's tensor.
1012  * @return Status code of the operation: OK(0) for success.
1013  */
1014 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_get_dims(const ie_blob_t *blob, dimensions_t *dims_result);
1015 
1016 /**
1017  * @brief Gets layout of blob's tensor.
1018  * @ingroup Blob
1019  * @param blob A pointer to the blob.
1020  * @param layout_result A pointer to the layout of blob's tensor.
1021  * @return Status code of the operation: OK(0) for success.
1022  */
1023 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_get_layout(const ie_blob_t *blob, layout_e *layout_result);
1024 
1025 /**
1026  * @brief Gets precision of blob's tensor.
1027  * @ingroup Blob
1028  * @param blob A pointer to the blob.
1029  * @param prec_result A pointer to the precision of blob's tensor.
1030  * @return Status code of the operation: OK(0) for success.
1031  */
1032 INFERENCE_ENGINE_C_API(IE_NODISCARD IEStatusCode) ie_blob_get_precision(const ie_blob_t *blob, precision_e *prec_result);
1033 
1034 /**
1035  * @brief Releases the memory occupied by the ie_blob_t pointer.
1036  * @ingroup Blob
1037  * @param blob A pointer to the blob pointer to release memory.
1038  */
1039 INFERENCE_ENGINE_C_API(void) ie_blob_free(ie_blob_t **blob);
1040 
1041 /** @} */ // end of Blob
1042 
1043 #endif // IE_C_API_H
IEStatusCode ie_blob_make_memory_nv12(const ie_blob_t *y, const ie_blob_t *uv, ie_blob_t **nv12Blob)
Creates a NV12 blob from two planes Y and UV.
IEStatusCode ie_blob_make_memory_with_roi(const ie_blob_t *inputBlob, const roi_t *roi, ie_blob_t **blob)
Creates a blob describing given roi_t instance based on the given blob with pre-allocated memory.
IEStatusCode ie_blob_get_dims(const ie_blob_t *blob, dimensions_t *dims_result)
Gets dimensions of blob's tensor.
void ie_blob_deallocate(ie_blob_t **blob)
Releases previously allocated data.
IEStatusCode ie_blob_size(ie_blob_t *blob, int *size_result)
Gets the total number of elements, which is a product of all the dimensions.
IEStatusCode ie_blob_make_memory_from_preallocated(const tensor_desc_t *tensorDesc, void *ptr, size_t size, ie_blob_t **blob)
Creates a blob with the given tensor descriptor from the pointer to the pre-allocated memory.
void ie_blob_free(ie_blob_t **blob)
Releases the memory occupied by the ie_blob_t pointer.
IEStatusCode ie_blob_make_memory(const tensor_desc_t *tensorDesc, ie_blob_t **blob)
Creates a blob with the specified dimensions, layout and to allocate memory.
IEStatusCode ie_blob_get_buffer(const ie_blob_t *blob, ie_blob_buffer_t *blob_buffer)
Gets access to the allocated memory .
IEStatusCode ie_blob_get_precision(const ie_blob_t *blob, precision_e *prec_result)
Gets precision of blob's tensor.
IEStatusCode ie_blob_make_memory_i420(const ie_blob_t *y, const ie_blob_t *u, const ie_blob_t *v, ie_blob_t **i420Blob)
Creates I420 blob from three planes Y, U and V.
IEStatusCode ie_blob_get_layout(const ie_blob_t *blob, layout_e *layout_result)
Gets layout of blob's tensor.
IEStatusCode ie_blob_get_cbuffer(const ie_blob_t *blob, ie_blob_buffer_t *blob_cbuffer)
Gets read-only access to the allocated memory.
IEStatusCode ie_blob_byte_size(ie_blob_t *blob, int *bsize_result)
Gets the size of the current Blob in bytes.
void ie_core_free(ie_core_t **core)
Releases memory occupied by core.
IEStatusCode ie_core_get_versions(const ie_core_t *core, const char *device_name, ie_core_versions_t *versions)
Gets version information of the device specified. Use the ie_core_versions_free() method to free memo...
IEStatusCode ie_core_load_network(ie_core_t *core, const ie_network_t *network, const char *device_name, const ie_config_t *config, ie_executable_network_t **exe_network)
Creates an executable network from a network object. Users can create as many networks as they need a...
IEStatusCode ie_core_unregister_plugin(ie_core_t *core, const char *device_name)
Unregisters a plugin with a specified device name.
IEStatusCode ie_core_get_available_devices(const ie_core_t *core, ie_available_devices_t *avai_devices)
Gets available devices for neural network inference.
IEStatusCode ie_core_register_plugin(ie_core_t *core, const char *plugin_name, const char *device_name)
Registers a new device and a plugin which implement this device inside Inference Engine.
IEStatusCode ie_core_load_network_from_file(ie_core_t *core, const char *xml, const char *device_name, const ie_config_t *config, ie_executable_network_t **exe_network)
Reads model and creates an executable network from IR or ONNX file. Users can create as many networks...
IEStatusCode ie_core_read_network(ie_core_t *core, const char *xml, const char *weights_file, ie_network_t **network)
Reads the model from the .xml and .bin files of the IR. Use the ie_network_free() method to free memo...
IEStatusCode ie_core_create(const char *xml_config_file, ie_core_t **core)
Constructs Inference Engine Core instance using XML configuration file with devices description....
IEStatusCode ie_core_get_metric(const ie_core_t *core, const char *device_name, const char *metric_name, ie_param_t *param_result)
Gets general runtime metric for dedicated hardware. The method is needed to request common device pro...
void ie_core_versions_free(ie_core_versions_t *vers)
Releases memory occupied by ie_core_versions.
IEStatusCode ie_core_get_config(const ie_core_t *core, const char *device_name, const char *config_name, ie_param_t *param_result)
Gets configuration dedicated to device behaviour. The method is targeted to extract information which...
IEStatusCode ie_core_read_network_from_memory(ie_core_t *core, const uint8_t *xml_content, size_t xml_content_size, const ie_blob_t *weight_blob, ie_network_t **network)
Reads the model from an xml string and a blob of the bin part of the IR. Use the ie_network_free() me...
void ie_core_available_devices_free(ie_available_devices_t *avai_devices)
Releases memory occpuied by ie_available_devices_t.
IEStatusCode ie_core_register_plugins(ie_core_t *core, const char *xml_config_file)
Registers plugins specified in an ".xml" configuration file.
IEStatusCode ie_core_add_extension(ie_core_t *core, const char *extension_path, const char *device_name)
Loads extension library to the device with a specified device name.
IEStatusCode ie_core_set_config(ie_core_t *core, const ie_config_t *ie_core_config, const char *device_name)
Sets configuration for device.
IEStatusCode ie_exec_network_set_config(ie_executable_network_t *ie_exec_network, const ie_config_t *param_config)
Sets configuration for current executable network. Currently, the method can be used when the network...
void ie_exec_network_free(ie_executable_network_t **ie_exec_network)
Releases memory occupied by ExecutableNetwork.
IEStatusCode ie_exec_network_get_metric(const ie_executable_network_t *ie_exec_network, const char *metric_name, ie_param_t *param_result)
Gets general runtime metric for an executable network. It can be network name, actual device ID on wh...
IEStatusCode ie_exec_network_create_infer_request(ie_executable_network_t *ie_exec_network, ie_infer_request_t **request)
Creates an inference request instance used to infer the network. The created request has allocated in...
IEStatusCode ie_exec_network_get_config(const ie_executable_network_t *ie_exec_network, const char *metric_config, ie_param_t *param_result)
Gets configuration for current executable network. The method is responsible to extract information w...
IEStatusCode ie_infer_request_wait(ie_infer_request_t *infer_request, const int64_t timeout)
Waits for the result to become available. Blocks until specified timeout elapses or the result become...
void ie_infer_request_free(ie_infer_request_t **infer_request)
Releases memory occupied by ie_infer_request_t instance.
IEStatusCode ie_infer_request_get_blob(ie_infer_request_t *infer_request, const char *name, ie_blob_t **blob)
Gets input/output data for inference.
IEStatusCode ie_infer_request_set_blob(ie_infer_request_t *infer_request, const char *name, const ie_blob_t *blob)
Sets input/output data to inference.
IEStatusCode ie_infer_set_completion_callback(ie_infer_request_t *infer_request, ie_complete_call_back_t *callback)
Sets a callback function that will be called on success or failure of asynchronous request.
IEStatusCode ie_infer_request_infer(ie_infer_request_t *infer_request)
Starts synchronous inference of the infer request and fill outputs.
IEStatusCode ie_infer_request_infer_async(ie_infer_request_t *infer_request)
Starts asynchronous inference of the infer request and fill outputs.
IEStatusCode ie_infer_request_set_batch(ie_infer_request_t *infer_request, const size_t size)
Sets new batch size for certain infer request when dynamic batching is enabled in executable network ...
IEStatusCode ie_network_get_input_layout(const ie_network_t *network, const char *input_name, layout_e *layout_result)
Gets a layout of the input data.
void ie_network_input_shapes_free(input_shapes_t *inputShapes)
Releases memory occupied by input_shapes.
void ie_network_free(ie_network_t **network)
When network is loaded into the Infernece Engine, it is not required anymore and should be released.
void ie_network_name_free(char **name)
Releases momory occupied by input_name or output_name.
IEStatusCode ie_network_get_output_name(const ie_network_t *network, const size_t number, char **name)
Gets name corresponding to the "number". Use the ie_network_name_free() method to free memory.
IEStatusCode ie_network_set_input_layout(ie_network_t *network, const char *input_name, const layout_e l)
Changes the layout of the input data named "input_name". This function should be called before loadin...
IEStatusCode ie_network_get_input_name(const ie_network_t *network, size_t number, char **name)
Gets name corresponding to the "number". Use the ie_network_name_free() method to free memory.
IEStatusCode ie_network_set_output_layout(ie_network_t *network, const char *output_name, const layout_e l)
Changes the layout of the output data named "output_name".
IEStatusCode ie_network_set_input_resize_algorithm(ie_network_t *network, const char *input_name, const resize_alg_e resize_algo)
Sets resize algorithm to be used during pre-processing.
IEStatusCode ie_network_get_name(const ie_network_t *network, char **name)
Get name of network.
IEStatusCode ie_network_get_input_shapes(ie_network_t *network, input_shapes_t *shapes)
Helper method collect all input shapes with input names of corresponding input data....
IEStatusCode ie_network_get_inputs_number(const ie_network_t *network, size_t *size_result)
Gets number of inputs for the network.
IEStatusCode ie_network_get_input_precision(const ie_network_t *network, const char *input_name, precision_e *prec_result)
Gets a precision of the input data provided by user.
IEStatusCode ie_network_get_output_layout(const ie_network_t *network, const char *output_name, layout_e *layout_result)
Gets a layout of the output data.
IEStatusCode ie_network_set_output_precision(ie_network_t *network, const char *output_name, const precision_e p)
Changes the precision of the output data named "output_name".
IEStatusCode ie_network_set_color_format(ie_network_t *network, const char *input_name, const colorformat_e color_format)
Changes the color format of the input data.
IEStatusCode ie_network_get_outputs_number(const ie_network_t *network, size_t *size_result)
Gets number of output for the network.
IEStatusCode ie_network_get_output_dims(const ie_network_t *network, const char *output_name, dimensions_t *dims_result)
Gets dimensions/shape of the output data with reversed order.
IEStatusCode ie_network_get_color_format(const ie_network_t *network, const char *input_name, colorformat_e *colformat_result)
Gets color format of the input data.
IEStatusCode ie_network_reshape(ie_network_t *network, const input_shapes_t shapes)
Run shape inference with new input shapes for the network.
IEStatusCode ie_network_get_input_dims(const ie_network_t *network, const char *input_name, dimensions_t *dims_result)
Gets dimensions/shape of the input data with reversed order.
IEStatusCode ie_network_set_input_precision(ie_network_t *network, const char *input_name, const precision_e p)
Changes the precision of the input data provided by the user. This function should be called before l...
IEStatusCode ie_network_get_output_precision(const ie_network_t *network, const char *output_name, precision_e *prec_result)
Gets a precision of the output data named "output_name".
IEStatusCode ie_network_get_input_resize_algorithm(const ie_network_t *network, const char *input_name, resize_alg_e *resize_alg_result)
Gets pre-configured resize algorithm.
IEStatusCode
This enum contains codes for all possible return values of the interface functions.
Definition: ie_c_api.h:231
colorformat_e
Extra information about input color format for preprocessing.
Definition: ie_c_api.h:207
@ BGRX
BGRX color format with X ignored during inference.
Definition: ie_c_api.h:212
@ RGB
RGB color format.
Definition: ie_c_api.h:209
@ BGR
BGR color format, default in DLDT.
Definition: ie_c_api.h:210
@ RGBX
RGBX color format with X ignored during inference.
Definition: ie_c_api.h:211
@ NV12
NV12 color format represented as compound Y+UV blob.
Definition: ie_c_api.h:213
@ RAW
Plain blob (default), no extra color processing required.
Definition: ie_c_api.h:208
@ I420
I420 color format represented as compound Y+U+V blob.
Definition: ie_c_api.h:214
precision_e
Precisions that the inference engine supports.
Definition: ie_c_api.h:172
@ U64
Definition: ie_c_api.h:187
@ U8
Definition: ie_c_api.h:181
@ FP32
Definition: ie_c_api.h:175
@ FP64
Definition: ie_c_api.h:177
@ BIN
Definition: ie_c_api.h:189
@ FP16
Definition: ie_c_api.h:176
@ MIXED
Definition: ie_c_api.h:174
@ U32
Definition: ie_c_api.h:188
@ I32
Definition: ie_c_api.h:185
@ Q78
Definition: ie_c_api.h:178
@ I8
Definition: ie_c_api.h:183
@ I16
Definition: ie_c_api.h:179
@ CUSTOM
Definition: ie_c_api.h:190
@ I64
Definition: ie_c_api.h:186
@ UNSPECIFIED
Definition: ie_c_api.h:173
@ I4
Definition: ie_c_api.h:182
@ U16
Definition: ie_c_api.h:184
@ U4
Definition: ie_c_api.h:180
void ie_version_free(ie_version_t *version)
Release the memory allocated by ie_c_api_version.
ie_version_t ie_c_api_version(void)
Returns number of version that is exported. Use the ie_version_free() to free memory.
layout_e
Layouts that the inference engine supports.
Definition: ie_c_api.h:139
@ BLOCKED
"BLOCKED" layout
Definition: ie_c_api.h:165
@ NC
"NC" layout
Definition: ie_c_api.h:162
@ NCHW
"NCHW" layout
Definition: ie_c_api.h:143
@ CN
"CN" layout
Definition: ie_c_api.h:163
@ C
"C" layout
Definition: ie_c_api.h:155
@ NHWC
"NHWC" layout
Definition: ie_c_api.h:144
@ OIHW
"OIHW" layout
Definition: ie_c_api.h:149
@ SCALAR
"SCALAR" layout
Definition: ie_c_api.h:152
@ CHW
"CHW" layout
Definition: ie_c_api.h:158
@ ANY
"ANY" layout
Definition: ie_c_api.h:140
@ HW
"HW" layout
Definition: ie_c_api.h:161
@ NCDHW
"NCDHW" layout
Definition: ie_c_api.h:145
@ NDHWC
"NDHWC" layout
Definition: ie_c_api.h:146
resize_alg_e
Represents the list of supported resize algorithms.
Definition: ie_c_api.h:221
@ RESIZE_BILINEAR
"Bilinear resize" mode
Definition: ie_c_api.h:223
@ RESIZE_AREA
"Area resize" mode
Definition: ie_c_api.h:224
@ NO_RESIZE
"No resize" mode
Definition: ie_c_api.h:222
void ie_param_free(ie_param_t *param)
Release the memory allocated by ie_param_t.
Represents detailed information for an error.
Definition: ie_c_api.h:122
char msg[256]
A description message.
Definition: ie_c_api.h:123
Represents dimensions for input or output data.
Definition: ie_c_api.h:130
size_t dims[8]
An array of dimensions.
Definition: ie_c_api.h:132
size_t ranks
A runk representing a number of dimensions.
Definition: ie_c_api.h:131
Represent all available devices.
Definition: ie_c_api.h:305
Represents copied data from the given blob.
Definition: ie_c_api.h:285
const void * cbuffer
cbuffer is read-only
Definition: ie_c_api.h:288
void * buffer
buffer can be written
Definition: ie_c_api.h:287
Completion callback definition about the function and args.
Definition: ie_c_api.h:296
Represents configuration information that describes devices.
Definition: ie_c_api.h:90
const char * name
A configuration key.
Definition: ie_c_api.h:91
const char * value
A configuration value.
Definition: ie_c_api.h:92
struct ie_config * next
A pointer to the next configuration value.
Definition: ie_c_api.h:93
Represents version information that describes devices and the inference engine runtime library.
Definition: ie_c_api.h:69
const char * build_number
A build number.
Definition: ie_c_api.h:73
size_t minor
A minor version.
Definition: ie_c_api.h:71
size_t major
A major version.
Definition: ie_c_api.h:70
const char * device_name
A device name.
Definition: ie_c_api.h:72
const char * description
A device description.
Definition: ie_c_api.h:74
Represents all versions information that describes all devices and the inference engine runtime libra...
Definition: ie_c_api.h:81
size_t num_vers
A number of versions in the array.
Definition: ie_c_api.h:83
ie_core_version_t * versions
An array of device versions.
Definition: ie_c_api.h:82
Represents configuration parameter information.
Definition: ie_c_api.h:113
metric and config parameters.
Definition: ie_c_api.h:100
Represents an API version information that reflects the set of supported features.
Definition: ie_c_api.h:61
char * api_version
A string representing Inference Engine version.
Definition: ie_c_api.h:62
Represents shape for input data.
Definition: ie_c_api.h:267
Represents shapes for all input data.
Definition: ie_c_api.h:276
This structure describes roi data.
Definition: ie_c_api.h:255
size_t sizeX
W size of roi.
Definition: ie_c_api.h:259
size_t id
ID of a roi.
Definition: ie_c_api.h:256
size_t posY
H upper left coordinate of roi.
Definition: ie_c_api.h:258
size_t posX
W upper left coordinate of roi.
Definition: ie_c_api.h:257
size_t sizeY
H size of roi.
Definition: ie_c_api.h:260
Represents detailed information for a tensor.
Definition: ie_c_api.h:197