Public Member Functions
ie_api.ExecutableNetwork Class Reference

This class represents a network instance loaded to plugin and ready for inference. More...

Public Member Functions

def __init__ (self)
 There is no explicit class constructor. More...

 
def infer (self, inputs=None)
 Starts synchronous inference for the first infer request of the executable network and returns output data. More...

 
def start_async (self, request_id, inputs=None)
 Starts asynchronous inference for specified infer request. More...

 
 
def get_exec_graph_info (self)
 Gets executable graph information from a device. More...

 
def get_metric (self, metric_name)
 Gets general runtime metric for an executable network. More...

 
def export (self, model_file)
 Exports the current executable network. More...

 

Class Attributes

requests
A tuple of InferRequest instances.
inputs
outputs

Detailed Description

This class represents a network instance loaded to plugin and ready for inference.

Constructor & Destructor Documentation

§ __init__()

def ie_api.ExecutableNetwork.__init__ (   self)

There is no explicit class constructor.

To make a valid instance of ExecutableNetwork, use load() method of the IEPlugin class.

Member Function Documentation

§ export()

def ie_api.ExecutableNetwork.export (   self,
  model_file 
)

Exports the current executable network.

Parameters
model_fileFull path to the target exported file location
Returns
None
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)
exec_net.export(path_to_file_to_save)

§ get_exec_graph_info()

def ie_api.ExecutableNetwork.get_exec_graph_info (   self)

Gets executable graph information from a device.

Returns
An instance of IENetwork

Usage example:

net = IENetwork(model=path_to_xml_file, weights=path_to_bin_file)
plugin = IEPlugin(device="CPU")
exec_net = plugin.load(network=net, num_requsts=2)
exec_graph = exec_net.get_exec_graph_info()

§ get_metric()

def ie_api.ExecutableNetwork.get_metric (   self,
  metric_name 
)

Gets general runtime metric for an executable network.

It can be network name, actual device ID on which executable network is running or all other properties which cannot be changed dynamically.

Parameters
metric_nameA metric name to request.
Returns
A metric value corresponding to a metric key.

Usage example:

ie = IECore()
net = IENetwork(model=path_to_xml_file, weights=path_to_bin_file)
exec_net = ie.load_network(net, "CPU")
exec_net.get_metric("NETWORK_NAME")

§ infer()

def ie_api.ExecutableNetwork.infer (   self,
  inputs = None 
)

Starts synchronous inference for the first infer request of the executable network and returns output data.

Wraps infer() method of the InferRequest class

Parameters
inputsA dictionary that maps input layer names to numpy.ndarray objects of proper shape with input data for the layer
Returns
A dictionary that maps output layer names to numpy.ndarray objects with output data of the layer

Usage example:

net = IENetwork(model=path_to_xml_file, weights=path_to_bin_file)
plugin = IEPlugin(device="CPU")
exec_net = plugin.load(network=net, num_requests=2)
res = exec_net.infer({'data': img})
res
{'prob': array([[[[2.83426580e-08]],
[[2.40166020e-08]],
[[1.29469613e-09]],
[[2.95946148e-08]]
......
]])}

§ start_async()

def ie_api.ExecutableNetwork.start_async (   self,
  request_id,
  inputs = None 
)

Starts asynchronous inference for specified infer request.

Wraps async_infer() method of the InferRequest class.

Parameters
request_idIndex of infer request to start inference
inputsA dictionary that maps input layer names to numpy.ndarray objects of proper shape with input data for the layer
Returns
A handler of specified infer request, which is an instance of the InferRequest class.

Usage example:

infer_request_handle = exec_net.start_async(request_id=0, inputs={input_blob: image})
infer_status = infer_request_handle.wait()
res = infer_request_handle.outputs[out_blob_name]