openvino.frontend.InputModel#

class openvino.frontend.InputModel#

Bases: pybind11_object

openvino.frontend.InputModel wraps ov::frontend::InputModel

__init__(*args, **kwargs)#

Methods

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(*args, **kwargs)

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)

__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

add_name_for_tensor(self, tensor, new_name)

Adds new name for tensor

add_output(self, place)

Assign this place as new output or add necessary nodes to represent a new output.

cut_and_add_new_input(self, place[, new_name])

Cut immediately before this place and assign this place as new input; prune

cut_and_add_new_output(self, place[, new_name])

Cut immediately before this place and assign this place as new output; prune all nodes that don't contribute to any output.

extract_subgraph(self, inputs, outputs)

Leaves only subgraph that are defined by new inputs and new outputs.

free_name_for_operation(self, name)

Unassign specified name from operation place(s).

free_name_for_tensor(self, name)

Unassign specified name from tensor place(s).

get_element_type(self, place)

Returns current element type used for this place.

get_inputs(self)

Returns all inputs for a model.

get_outputs(self)

Returns all outputs for a model.

get_partial_shape(self, place)

Returns current partial shape used for this place.

get_place_by_input_index(self, input_idx)

Returns a tensor place by an input index.

get_place_by_operation_name(self, operation_name)

Returns an operation place by an operation name following framework conventions, or nullptr if an operation with this name doesn't exist.

get_place_by_operation_name_and_input_port(...)

Returns an input port place by operation name and appropriate port index.

get_place_by_operation_name_and_output_port(...)

Returns an output port place by operation name and appropriate port index.

get_place_by_tensor_name(self, tensor_name)

Returns a tensor place by a tensor name following framework conventions, or nullptr if a tensor with this name doesn't exist.

override_all_inputs(self, inputs)

Modifies the graph to use new inputs instead of existing ones.

override_all_outputs(self, outputs)

Replaces all existing outputs with new ones removing all data flow that is not required for new outputs.

remove_output(self, place)

Removes any sinks directly attached to this place with all inbound data flow if it is not required by any other output.

set_element_type(self, place, type)

Sets new element type for a place.

set_name_for_dimension(self, place, ...)

Set name for a particular dimension of a place (e.g. batch dimension).

set_name_for_operation(self, operation, new_name)

Adds new name for tensor.

set_name_for_tensor(self, tensor, new_name)

Sets name for tensor.

set_partial_shape(self, place, shape)

Defines all possible shape that may be used for this place; place should be uniquely refer to some data.

set_tensor_value(self, place, value)

Sets new element type for a place.

__class__#

alias of pybind11_type

__delattr__(name, /)#

Implement delattr(self, name).

__dir__()#

Default dir() implementation.

__eq__(value, /)#

Return self==value.

__format__(format_spec, /)#

Default object formatter.

__ge__(value, /)#

Return self>=value.

__getattribute__(name, /)#

Return getattr(self, name).

__gt__(value, /)#

Return self>value.

__hash__()#

Return hash(self).

__init__(*args, **kwargs)#
__init_subclass__()#

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__(value, /)#

Return self<=value.

__lt__(value, /)#

Return self<value.

__ne__(value, /)#

Return self!=value.

__new__(**kwargs)#
__reduce__()#

Helper for pickle.

__reduce_ex__(protocol, /)#

Helper for pickle.

__repr__()#

Return repr(self).

__setattr__(name, value, /)#

Implement setattr(self, name, value).

__sizeof__()#

Size of object in memory, in bytes.

__str__()#

Return str(self).

__subclasshook__()#

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

add_name_for_tensor(self: openvino._pyopenvino.InputModel, tensor: openvino._pyopenvino.Place, new_name: str) None#

Adds new name for tensor

Parameters:
add_output(self: openvino._pyopenvino.InputModel, place: openvino._pyopenvino.Place) openvino._pyopenvino.Place#

Assign this place as new output or add necessary nodes to represent a new output.

Parameters:

place (openvino.frontend.Place) – Anchor point to add an output.

cut_and_add_new_input(self: openvino._pyopenvino.InputModel, place: openvino._pyopenvino.Place, new_name: str = '') None#

Cut immediately before this place and assign this place as new input; prune all nodes that don’t contribute to any output.

Parameters:
  • place (openvino.frontend.Place) – New place to be assigned as input.

  • new_name (str) – Optional new name assigned to this input place.

cut_and_add_new_output(self: openvino._pyopenvino.InputModel, place: openvino._pyopenvino.Place, new_name: str = '') None#

Cut immediately before this place and assign this place as new output; prune all nodes that don’t contribute to any output.

Parameters:
  • place (openvino.frontend.Place) – New place to be assigned as output.

  • new_name (str) – Optional new name assigned to this output place.

extract_subgraph(self: openvino._pyopenvino.InputModel, inputs: list[openvino._pyopenvino.Place], outputs: list[openvino._pyopenvino.Place]) None#

Leaves only subgraph that are defined by new inputs and new outputs.

Parameters:
free_name_for_operation(self: openvino._pyopenvino.InputModel, name: str) None#

Unassign specified name from operation place(s).

Parameters:

name (str) – Name of operation.

free_name_for_tensor(self: openvino._pyopenvino.InputModel, name: str) None#

Unassign specified name from tensor place(s).

Parameters:

name (str) – Name of tensor.

get_element_type(self: openvino._pyopenvino.InputModel, place: openvino._pyopenvino.Place) openvino._pyopenvino.Type#

Returns current element type used for this place.

Parameters:

place (openvino.frontend.Place) – Model place.

Returns:

Element type for this place.

Return type:

openvino.runtime.Type

get_inputs(self: openvino._pyopenvino.InputModel) list[openvino._pyopenvino.Place]#

Returns all inputs for a model.

Returns:

A list of input places.

Return type:

List[openvino.frontend.Place]

get_outputs(self: openvino._pyopenvino.InputModel) list[openvino._pyopenvino.Place]#

Returns all outputs for a model. An output is a terminal place in a graph where data escapes the flow.

Returns:

A list of output places.

Return type:

List[openvino.frontend.Place]

get_partial_shape(self: openvino._pyopenvino.InputModel, place: openvino._pyopenvino.Place) openvino._pyopenvino.PartialShape#

Returns current partial shape used for this place.

Parameters:

place (openvino.frontend.Place) – Model place.

Returns:

Partial shape for this place.

Return type:

openvino.runtime.PartialShape

get_place_by_input_index(self: openvino._pyopenvino.InputModel, input_idx: int) openvino._pyopenvino.Place#

Returns a tensor place by an input index.

Parameters:

input_idx (int) – Index of model input.

Returns:

Tensor place corresponding to specified input index or nullptr.

Return type:

openvino.frontend.Place

get_place_by_operation_name(self: openvino._pyopenvino.InputModel, operation_name: str) openvino._pyopenvino.Place#

Returns an operation place by an operation name following framework conventions, or nullptr if an operation with this name doesn’t exist.

Parameters:

operation_name (str) – Name of operation.

Returns:

Place representing operation.

Return type:

openvino.frontend.Place

get_place_by_operation_name_and_input_port(self: openvino._pyopenvino.InputModel, operation_name: str, input_port_index: int) openvino._pyopenvino.Place#

Returns an input port place by operation name and appropriate port index.

Parameters:
  • operation_name (str) – Name of operation.

  • input_port_index (int) – Index of input port for this operation.

Returns:

Place representing input port of operation.

Return type:

openvino.frontend.Place

get_place_by_operation_name_and_output_port(self: openvino._pyopenvino.InputModel, operation_name: str, output_port_index: int) openvino._pyopenvino.Place#

Returns an output port place by operation name and appropriate port index.

Parameters:
  • operation_name (str) – Name of operation.

  • output_port_index (int) – Index of output port for this operation.

Returns:

Place representing output port of operation.

Return type:

openvino.frontend.Place

get_place_by_tensor_name(self: openvino._pyopenvino.InputModel, tensor_name: str) openvino._pyopenvino.Place#

Returns a tensor place by a tensor name following framework conventions, or nullptr if a tensor with this name doesn’t exist.

Parameters:

tensor_name (str) – Name of tensor.

Returns:

Tensor place corresponding to specified tensor name.

Return type:

openvino.frontend.Place

override_all_inputs(self: openvino._pyopenvino.InputModel, inputs: list[openvino._pyopenvino.Place]) None#

Modifies the graph to use new inputs instead of existing ones. New inputs should completely satisfy all existing outputs.

Parameters:

inputs (List[openvino.frontend.Place]) – Array of new input places.

override_all_outputs(self: openvino._pyopenvino.InputModel, outputs: list[openvino._pyopenvino.Place]) None#

Replaces all existing outputs with new ones removing all data flow that is not required for new outputs.

Parameters:

outputs (List[openvino.frontend.Place]) – Vector with places that will become new outputs; may intersect existing outputs.

remove_output(self: openvino._pyopenvino.InputModel, place: openvino._pyopenvino.Place) None#

Removes any sinks directly attached to this place with all inbound data flow if it is not required by any other output.

Parameters:

place (openvino.frontend.Place) – Model place.

set_element_type(self: openvino._pyopenvino.InputModel, place: openvino._pyopenvino.Place, type: openvino._pyopenvino.Type) None#

Sets new element type for a place.

Parameters:
set_name_for_dimension(self: openvino._pyopenvino.InputModel, place: openvino._pyopenvino.Place, dim_index: int, dim_name: str) None#

Set name for a particular dimension of a place (e.g. batch dimension).

Parameters:
  • place (openvino.frontend.Place) – Model’s place.

  • dim_index (int) – Dimension index.

  • dim_name – Name to assign on this dimension.

set_name_for_operation(self: openvino._pyopenvino.InputModel, operation: openvino._pyopenvino.Place, new_name: str) None#

Adds new name for tensor.

Parameters:
set_name_for_tensor(self: openvino._pyopenvino.InputModel, tensor: openvino._pyopenvino.Place, new_name: str) None#

Sets name for tensor. Overwrites existing names of this place.

Parameters:
set_partial_shape(self: openvino._pyopenvino.InputModel, place: openvino._pyopenvino.Place, shape: openvino._pyopenvino.PartialShape) None#

Defines all possible shape that may be used for this place; place should be uniquely refer to some data. This partial shape will be converted to corresponding shape of results ngraph nodes and will define shape inference when the model is converted to ngraph.

Parameters:
set_tensor_value(self: openvino._pyopenvino.InputModel, place: openvino._pyopenvino.Place, value: numpy.ndarray) None#

Sets new element type for a place.

Parameters: