Public Member Functions | Data Fields
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 requests (self)
 A tuple of InferRequest instances.
 
def input_info (self)
 A dictionary that maps input layer names to InputInfoCPtr objects.
 
def inputs (self)
 
def outputs (self)
 A dictionary that maps output layer names to CDataPtr objects.
 
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 get_config (self, config_name)
 Gets configuration for current executable network. More...
 
def export (self, model_file)
 Exports the current executable network. More...
 
def wait (self, num_requests=None, timeout=None)
 Waits when the result from any request becomes available. More...
 
def get_idle_request_id (self)
 Get idle request ID. More...
 

Data Fields

 requests
 A tuple of InferRequest instances.
 
 input_info
 A dictionary that maps input layer names to InputInfoCPtr objects.
 
 inputs
 
 outputs
 A dictionary that maps output layer names to CDataPtr objects.
 

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_network() method of the IECore 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
ie = IECore()
net = ie.read_network(model=path_to_xml_file, weights=path_to_bin_file)
exec_net = ie.load_network(network=net, device_name="MYRIAD", num_requests=2)
exec_net.export(path_to_file_to_save)

◆ get_config()

def ie_api.ExecutableNetwork.get_config (   self,
  config_name 
)

Gets configuration for current executable network.

The method is responsible to extract information which affects executable network execution

Parameters
config_nameA configuration parameter name to request.
Returns
A configuration value corresponding to a configuration key.

Usage example:

ie = IECore()
net = ie.read_network(model=path_to_xml_file, weights=path_to_bin_file)
exec_net = ie.load_network(net, "CPU")
config = exec_net.get_config("CPU_BIND_THREAD")

◆ 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:

ie_core = IECore()
net = ie_core.read_network(model=path_to_xml_file, weights=path_to_bin_file)
exec_net = ie_core.load_network(net, device, num_requests=2)
exec_graph = exec_net.get_exec_graph_info()

◆ get_idle_request_id()

def ie_api.ExecutableNetwork.get_idle_request_id (   self)

Get idle request ID.

Returns
Request index

◆ 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 = ie.read_network(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:

ie_core = IECore()
net = ie_core.read_network(model=path_to_xml_file, weights=path_to_bin_file)
exec_net = ie_core.load_network(network=net, device_name="CPU", num_requests=2)
res = exec_net.infer({'data': img})
res
{'prob': array([[[[2.83426580e-08]],
[[2.40166020e-08]],
[[1.29469613e-09]],
[[2.95946148e-08]]
......
]])}

◆ inputs()

def ie_api.ExecutableNetwork.inputs (   self)
Note
The property is deprecated. Please use the input_info property to get the map of inputs

A dictionary that maps input layer names to DataPtr objects

◆ 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.output_blobs[out_blob_name]

◆ wait()

def ie_api.ExecutableNetwork.wait (   self,
  num_requests = None,
  timeout = None 
)

Waits when the result from any request becomes available.

Blocks until specified timeout elapses or the result.

Parameters
num_requestsNumber of idle requests for which wait. If not specified, num_requests value is set to number of requests by default.
timeoutTime to wait in milliseconds or special (0, -1) cases described above. If not specified, timeout value is set to -1 by default.
Returns
Request status code: OK or RESULT_NOT_READY

Field Documentation

◆ inputs

ie_api.ExecutableNetwork.inputs
Note
The property is deprecated. Please use the input_info property to get the map of inputs

A dictionary that maps input layer names to DataPtr objects


The documentation for this class was generated from the following file: