Core

Overview

Set of functions dedicated to working with registered plugins and loading network to the registered devices. More…

// global functions

IEStatusCode ie_core_create(const char* xml_config_file, ie_core_t** core);
void ie_core_free(ie_core_t** core);

IEStatusCode ie_core_get_versions(
    const ie_core_t* core,
    const char* device_name,
    ie_core_versions_t* versions
    );

void ie_core_versions_free(ie_core_versions_t* vers);

IEStatusCode ie_core_read_network(
    ie_core_t* core,
    const char* xml,
    const char* weights_file,
    ie_network_t** network
    );

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
    );

IEStatusCode ie_core_import_network(
    ie_core_t* core,
    const char* file_name,
    const char* device_name,
    const ie_config_t* config,
    ie_executable_network_t** exe_network
    );

IEStatusCode ie_core_import_network_from_memory(
    ie_core_t* core,
    const uint8_t* content,
    size_t content_size,
    const char* device_name,
    const ie_config_t* config,
    ie_executable_network_t** exe_network
    );

IEStatusCode ie_core_export_network(
    ie_executable_network_t* exe_network,
    const char* file_name
    );

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
    );

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
    );

IEStatusCode ie_core_set_config(
    ie_core_t* core,
    const ie_config_t* ie_core_config,
    const char* device_name
    );

IEStatusCode ie_core_register_plugin(
    ie_core_t* core,
    const char* plugin_name,
    const char* device_name
    );

IEStatusCode ie_core_register_plugins(
    ie_core_t* core,
    const char* xml_config_file
    );

IEStatusCode ie_core_unregister_plugin(ie_core_t* core, const char* device_name);

IEStatusCode ie_core_add_extension(
    ie_core_t* core,
    const char* extension_path,
    const char* device_name
    );

IEStatusCode ie_core_get_metric(
    const ie_core_t* core,
    const char* device_name,
    const char* metric_name,
    ie_param_t* param_result
    );

IEStatusCode ie_core_get_config(
    const ie_core_t* core,
    const char* device_name,
    const char* config_name,
    ie_param_t* param_result
    );

IEStatusCode ie_core_get_available_devices(
    const ie_core_t* core,
    ie_available_devices_t* avai_devices
    );

void ie_core_available_devices_free(ie_available_devices_t* avai_devices);

Detailed Documentation

Set of functions dedicated to working with registered plugins and loading network to the registered devices.

Global Functions

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. See RegisterPlugins for more details. Use the ie_core_free() method to free memory.

Parameters:

xml_config_file

A path to .xml file with devices to load from. If XML configuration file is not specified, then default Inference Engine devices are loaded from the default plugin.xml file.

core

A pointer to the newly created ie_core_t.

Returns:

Status code of the operation: OK(0) for success.

void ie_core_free(ie_core_t** core)

Releases memory occupied by core.

Parameters:

core

A pointer to the core to free memory.

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 memory.

Parameters:

core

A pointer to ie_core_t instance.

device_name

Name to identify device.

versions

A pointer to versions corresponding to device_name.

Returns:

Status code of the operation: OK(0) for success.

void ie_core_versions_free(ie_core_versions_t* vers)

Releases memory occupied by ie_core_versions.

Parameters:

vers

A pointer to the ie_core_versions to free memory.

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 memory.

Parameters:

core

A pointer to the ie_core_t instance.

xml

.xml file’s path of the IR.

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 if bin file with the same name was not found, will load IR without weights.

network

A pointer to the newly created network.

Returns:

Status code of the operation: OK(0) for success.

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() method to free memory.

Parameters:

core

A pointer to the ie_core_t instance.

xml_content

Xml content of the IR.

xml_content_size

Number of bytes in the xml content of the IR.

weight_blob

Blob containing the bin part of the IR.

network

A pointer to the newly created network.

Returns:

Status code of the operation: OK(0) for success.

IEStatusCode ie_core_import_network(
    ie_core_t* core,
    const char* file_name,
    const char* device_name,
    const ie_config_t* config,
    ie_executable_network_t** exe_network
    )

Creates an executable network from a network previously exported to a file. Users can create as many networks as they need and use them simultaneously (up to the limitation of the hardware resources). Use the ie_exec_network_free() method to free memory.

Parameters:

core

A pointer to the ie_core_t instance.

file_name

A path to the location of the exported file.

device_name

A name of the device to load the network to.

config

Device configuration.

exe_network

A pointer to the newly created executable network.

Returns:

Status code of the operation: OK(0) for success.

IEStatusCode ie_core_import_network_from_memory(
    ie_core_t* core,
    const uint8_t* content,
    size_t content_size,
    const char* device_name,
    const ie_config_t* config,
    ie_executable_network_t** exe_network
    )

Creates an executable network from a network previously exported to memory. Users can create as many networks as they need and use them simultaneously (up to the limitation of the hardware resources). Use the ie_exec_network_free() method to free memory.

Parameters:

core

A pointer to the ie_core_t instance.

content

A pointer to content of the exported network.

content_size

Number of bytes in the exported network.

device_name

A name of the device to load the network to.

config

Device configuration.

exe_network

A pointer to the newly created executable network.

Returns:

Status code of the operation: OK(0) for success.

IEStatusCode ie_core_export_network(
    ie_executable_network_t* exe_network,
    const char* file_name
    )

Exports an executable network to a .bin file.

Parameters:

exe_network

A pointer to the newly created executable network.

file_name

Path to the file to export the network to.

Returns:

Status code of the operation: OK(0) for success.

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 given network object. Users can create as many networks as they need and use them simultaneously (up to the limitation of the hardware resources). Use the ie_exec_network_free() method to free memory.

Parameters:

core

A pointer to the ie_core_t instance.

network

A pointer to the input ie_network instance to create the executable network from.

device_name

Name of the device to load the network to.

config

Device configuration.

exe_network

A pointer to the newly created executable network.

Returns:

Status code of the operation: OK(0) for success.

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 as they need and use them simultaneously (up to the limitation of the hardware resources). Use the ie_exec_network_free() method to free memory.

Parameters:

core

A pointer to the ie_core_t instance.

xml

.xml file’s path of the IR. Weights file name will be calculated automatically

device_name

Name of device to load network to.

config

Device configuration.

exe_network

A pointer to the newly created executable network.

Returns:

Status code of the operation: OK(0) for success.

IEStatusCode ie_core_set_config(
    ie_core_t* core,
    const ie_config_t* ie_core_config,
    const char* device_name
    )

Sets configuration for device.

Parameters:

core

A pointer to ie_core_t instance.

ie_core_config

Device configuration.

device_name

An optional name of a device. If device name is not specified, the config is set for all the registered devices.

Returns:

Status code of the operation: OK(0) for success.

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.

Parameters:

core

A pointer to ie_core_t instance.

plugin_name

A name of a plugin. Depending on a platform, plugin_name is wrapped with a shared library suffix and a prefix to identify a full name of the library.

device_name

A device name to register plugin for. If not specified, the method registers a plugin with the default name.

Returns:

Status code of the operation: OK(0) for success.

IEStatusCode ie_core_register_plugins(
    ie_core_t* core,
    const char* xml_config_file
    )

Registers plugins specified in an “.xml” configuration file.

Parameters:

core

A pointer to ie_core_t instance.

xml_config_file

A full path to “.xml” file containing plugins configuration.

Returns:

Status code of the operation: OK(0) for success.

IEStatusCode ie_core_unregister_plugin(ie_core_t* core, const char* device_name)

Unregisters a plugin with a specified device name.

Parameters:

core

A pointer to ie_core_t instance.

device_name

A device name of the device to unregister.

Returns:

Status code of the operation: OK(0) for success.

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.

Parameters:

core

A pointer to ie_core_t instance.

extension_path

Path to the extensions library file to load to a device.

device_name

A device name of a device to load the extensions to.

Returns:

Status code of the operation: OK(0) for success.

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 properties which are executable network agnostic. It can be device name, temperature, other devices-specific values.

Parameters:

core

A pointer to ie_core_t instance.

device_name

A name of a device to get a metric value.

metric_name

A metric name to request.

param_result

A metric value corresponding to the metric_name.

Returns:

Status code of the operation: OK(0) for success.

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 can be set via SetConfig method.

Parameters:

core

A pointer to ie_core_t instance.

device_name

A name of a device to get a configuration value.

config_name

Name of a configuration.

param_result

A configuration value corresponding to the config_name.

Returns:

Status code of the operation: OK(0) for success.

IEStatusCode ie_core_get_available_devices(
    const ie_core_t* core,
    ie_available_devices_t* avai_devices
    )

Gets available devices for neural network inference.

Parameters:

core

A pointer to ie_core_t instance.

avai_devices

The devices are returned as { CPU, FPGA.0, FPGA.1, MYRIAD } If there more than one device of specific type, they are enumerated with .# suffix

Returns:

Status code of the operation: OK(0) for success.

void ie_core_available_devices_free(ie_available_devices_t* avai_devices)

Releases memory occpuied by ie_available_devices_t.

Parameters:

avai_devices

A pointer to the ie_available_devices_t to free memory.