Public Member Functions
ie_api.IECore Class Reference

This class represents an Inference Engine entity and allows you to manipulate with plugins using unified interfaces. More...

Public Member Functions

def __init__ (self, xml_config_file="")
 Class constructor. More...

 
def get_versions (self, device_name)
 Get a namedtuple object with versions of the plugin specified. More...

 
def load_network (self, IENetwork, network, str, device_name, config=None, int, num_requests=1)
 Loads a network that was read from the Intermediate Representation (IR) to the plugin with specified device name and creates an ExecutableNetwork object of the IENetwork class. More...

 
def import_network (self, str, model_file, str, device_name, config=None, int, num_requests=1)
 Creates an executable network from a previously exported network. More...

 
def query_network (self, IENetwork, network, str, device_name, config=None)
 Queries the plugin with specified device name what network layers are supported in the current configuration. More...

 
def register_plugin (self, plugin_name, device_name)
 Registers plugins specified in an .xml configuration file. More...

 
def register_plugins (self, xml_config_file)
 Registers plugins specified in an .xml configuration file. More...

 
def unregister_plugin (self, device_name)
 Unregisters a plugin with a specified device name. More...

 
def add_extension
 Loads extension library to the plugin with a specified device name. More...

 
def get_metric
 Gets a general runtime metric for dedicated hardware. More...

 
 

Class Attributes

available_devices

A list of devices.

The devices are returned as [CPU, FPGA.0, FPGA.1, MYRIAD]. If there are more than one device of a specific type, they all are listed followed by a dot and a number.

Detailed Description

This class represents an Inference Engine entity and allows you to manipulate with plugins using unified interfaces.

Constructor & Destructor Documentation

§ __init__()

def ie_api.IECore.__init__ (   self,
  xml_config_file = "" 
)

Class constructor.

Parameters
xml_config_fileA full path to .xml file containing plugins configuration. If the parameter is not specified, the default configuration is handled automatically.
Returns
Instance of IECore class

Member Function Documentation

§ add_extension()

def ie_api.IECore.add_extension (   self,
  extension_path,
  device_name 
)

Loads extension library to the plugin with a specified device name.

Parameters
extension_pathPath to the extensions library file to load to a plugin
device_nameA device name of a plugin to load the extensions to
Returns
None

Usage example:

ie = IECore()
ie.add_extension(extension_path="/some_dir/libcpu_extension_avx2.so", device_name="CPU")

§ get_metric()

def ie_api.IECore.get_metric (   self,
  device_name,
  metric_name 
)

Gets a general runtime metric for dedicated hardware.

Enables to request common device properties, which are ExecutableNetwork agnostic, such as device name, temperature, and other devices-specific values.

Parameters
device_nameA name of a device to get a metric value.
metric_nameA metric name to request.
Returns
A metric value corresponding to a metric key.

Usage example:

ie = IECore()
ie.get_metric(metric_name="SUPPORTED_METRICS", device_name="CPU")

§ get_versions()

def ie_api.IECore.get_versions (   self,
  device_name 
)

Get a namedtuple object with versions of the plugin specified.

Parameters
device_nameName of the the registered plugin
Returns
Dictionary mapping a plugin name and Versions namedtuple object with the following fields:
  • major - major plugin integer version
  • minor - minor plugin integer version
  • build_number - plugin build number string
  • description - plugin description string

§ import_network()

def ie_api.IECore.import_network (   self,
  str,
  model_file,
  str,
  device_name,
  config = None,
  int,
  num_requests = 1 
)

Creates an executable network from a previously exported network.

Parameters
device_nameName of device load executable network on
model_fileFull path to the location of the exported file
configA dictionary of plugin configuration keys and their values
num_requestsA positive integer value of infer requests to be created. Number of infer requests is limited by device capabilities.
Returns
An ExecutableNetwork object Usage example:

net = IENetwork(model=path_to_xml_file, weights=path_to_bin_file)
ie = IECore()
exec_net = plugin.load_network(network=net, device_name="MYRIAD", num_requsts=2)
# export executable network
exec_net.export(path_to_file_to_save)
# import previously exported executable network
exec_net_imported = ie.import_network(model_file=path_to_file_to_save, device_name="MYRIAD")

§ load_network()

def ie_api.IECore.load_network (   self,
  IENetwork,
  network,
  str,
  device_name,
  config = None,
  int,
  num_requests = 1 
)

Loads a network that was read from the Intermediate Representation (IR) to the plugin with specified device name and creates an ExecutableNetwork object of the IENetwork class.

You can create as many networks as you need and use them simultaneously (up to the limitation of the hardware resources).

Parameters
networkA valid IENetwork instance
device_nameA device name of a target plugin
configA dictionary of plugin configuration keys and their values
num_requestsA positive integer value of infer requests to be created. Number of infer requests is limited by device capabilities.
Returns
An ExecutableNetwork object

Usage example:

net = IENetwork(model=path_to_xml_file, weights=path_to_bin_file)
ie = IECore()
exec_net = plugin.load_network(network=net, device_name="CPU", num_requsts=2)

§ query_network()

def ie_api.IECore.query_network (   self,
  IENetwork,
  network,
  str,
  device_name,
  config = None 
)

Queries the plugin with specified device name what network layers are supported in the current configuration.

Please note that layers support depends on plugin configuration and loaded extensions.

Parameters
networkA valid IENetwork instance
device_nameA device name of a target plugin
configA dictionary of plugin configuration keys and their values
Returns
A dictionary mapping layers and device names on which they are supported

Usage example:

net = IENetwork(model=path_to_xml_file, weights=path_to_bin_file)
ie = IECore()
layers_map = plugin.query_network(network=net, device_name="HETERO:GPU,CPU")

§ register_plugin()

def ie_api.IECore.register_plugin (   self,
  plugin_name,
  device_name 
)

Registers plugins specified in an .xml configuration file.

Parameters
plugin_nameA 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_nameA target device name for the plugin. If not specified, the method registers a plugin with the default name.
Returns
None

Usage example:

ie = IECore()
ie.register_plugin(plugin="MKLDNNPlugin", device_name="MY_NEW_PLUGIN")

§ register_plugins()

def ie_api.IECore.register_plugins (   self,
  xml_config_file 
)

Registers plugins specified in an .xml configuration file.

Parameters
xml_config_fileA full path to .xml file containing plugins configuration
Returns
None

Usage example:

ie = IECore()
ie.register_plugins("/localdisk/plugins/my_custom_cfg.xml")

§ unregister_plugin()

def ie_api.IECore.unregister_plugin (   self,
  device_name 
)

Unregisters a plugin with a specified device name.

Parameters
device_nameA device name of the plugin to unregister
Returns
None

Usage example:

ie = IECore()
plugin = IEPlugin("GPU")
ie.register_plugin(plugin=plugin, device_name="MY_NEW_GPU")
ie.unregister_plugin(device_name="GPU")