openvino.runtime.opset15.if_op#
- class openvino.runtime.opset15.if_op#
Bases:
Node
openvino.impl.op.If wraps ov::op::v0::If
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: openvino._pyopenvino.op.if_op) -> None
__init__(self: openvino._pyopenvino.op.if_op, execution_condition: ov::Output<ov::Node>) -> None
Constructs If with condition.
- param execution_condition:
condition node.
- type execution_condition:
openvino.runtime.Output
- rtype:
openvino.impl.op.If
__init__(self: openvino._pyopenvino.op.if_op, execution_condition: openvino._pyopenvino.Node) -> None
Constructs If with condition.
- param execution_condition:
condition node.
- type execution_condition:
openvino.runtime.Node
- rtype:
openvino.impl.op.If
Methods
__add__
(right_node[, auto_broadcast, name])Return node which applies f(A,B) = A+B to the input nodes element-wise.
__delattr__
(name, /)Implement delattr(self, name).
__dir__
()Default dir() implementation.
__div__
(right_node[, auto_broadcast, name])Return node which applies f(x) = A/B to the input nodes element-wise.
__eq__
(right_node[, auto_broadcast, name])Return node which checks if input nodes are equal element-wise.
__format__
(format_spec, /)Default object formatter.
__ge__
(right_node[, auto_broadcast, name])Return node which checks if left node is greater or equal to the right node element-wise.
__getattr__
(self, arg0)__getattribute__
(name, /)Return getattr(self, name).
__gt__
(right_node[, auto_broadcast, name])Return node which checks if left input node is greater than the right node element-wise.
__hash__
()Return hash(self).
__init__
(*args, **kwargs)Overloaded function.
This method is called when a class is subclassed.
__le__
(right_node[, auto_broadcast, name])Return node which checks if left input node is less or equal the right node element-wise.
__lt__
(right_node[, auto_broadcast, name])Return node which checks if left input node is less than the right node element-wise.
__mul__
(right_node[, auto_broadcast, name])Return node which applies f(A,B) = A*B to the input nodes elementwise.
__ne__
(right_node[, auto_broadcast, name])Return node which checks if input nodes are unequal element-wise.
__new__
(**kwargs)__radd__
(right)__rdiv__
(right)Helper for pickle.
__reduce_ex__
(protocol, /)Helper for pickle.
__repr__
(self)__rmul__
(right)__rsub__
(right)__rtruediv__
(right)__setattr__
(name, value, /)Implement setattr(self, name, value).
Size of object in memory, in bytes.
__str__
()Return str(self).
__sub__
(right_node[, auto_broadcast, name])Return node which applies f(x) = A-B to the input nodes element-wise.
Abstract classes can override this to customize issubclass().
__truediv__
(right_node[, auto_broadcast, name])Return node which applies f(x) = A/B to the input nodes element-wise.
evaluate
(*args, **kwargs)Overloaded function.
get_attributes
(self)get_element_type
(self)Checks that there is exactly one output and returns it's element type.
get_else_body
(self)Gets else_body as Model object.
get_friendly_name
(self)Gets the friendly name for a node.
get_function
(self, index)Gets internal sub-graph by index in MultiSubGraphOp.
get_input_descriptions
(self, index)Gets list with connections between operation inputs and internal sub-graph parameters.
get_input_element_type
(self, index)Returns the element type for input index
get_input_partial_shape
(self, index)Returns the partial shape for input index
get_input_shape
(self, index)Returns the shape for input index
get_input_size
(self)Returns the number of inputs to the node.
get_input_tensor
(self, index)Returns the tensor for the node's input with index i
get_instance_id
(self)Returns id of the node.
get_name
(self)Get the unique name of the node
get_output_descriptions
(self, index)Gets list with connections between operation outputs and internal sub-graph parameters.
get_output_element_type
(self, index)Returns the element type for output index
get_output_partial_shape
(self, index)Returns the partial shape for output index
get_output_shape
(self, index)Returns the shape for output index
get_output_size
(self)Returns the number of outputs from the node.
get_output_tensor
(self, index)Returns the tensor for output index
get_rt_info
(self)Returns PyRTMap which is a dictionary of user defined runtime info.
get_then_body
(self)Gets then_body as Model object.
get_type_info
(self)get_type_name
(self)Returns Type's name from the node.
input
(self, input_index)A handle to the input_index input of this node.
input_value
(self, index)Returns input of the node with index i
input_values
(self)Returns list of node's inputs, in order.
inputs
(self)A list containing a handle for each of this node's inputs, in order.
output
(self, output_index)A handle to the output_index output of this node.
outputs
(self)A list containing a handle for each of this node's outputs, in order.
set_argument
(self, arg0, arg1)set_arguments
(*args, **kwargs)Overloaded function.
set_attribute
(self, arg0, arg1)set_else_body
(self, body)Sets new Model object as new else_body.
set_friendly_name
(self, name)Sets a friendly name for a node.
set_function
(self, index, func)Adds sub-graph to MultiSubGraphOp.
set_input
(self, value, then_parameter, ...)Sets new input to the operation associated with parameters of each sub-graphs.
set_input_descriptions
(self, index, inputs)Sets list with connections between operation inputs and internal sub-graph parameters.
set_output
(self, then_result, else_result)Sets new output from the operation associated with results of each sub-graphs.
set_output_descriptions
(self, index, outputs)Sets list with connections between operation outputs and internal sub-graph parameters.
set_output_size
(self, size)Sets the number of outputs
set_output_type
(self, index, element_type, shape)Sets output's element type and shape.
set_then_body
(self, body)Sets new Model object as new then_body.
validate_and_infer_types
(self)Verifies that attributes and inputs are consistent and computes output shapes and element types.
Attributes
- __add__(right_node: Node | int | float | ndarray, auto_broadcast: str = 'NUMPY', name: str | None = None) Node #
Return node which applies f(A,B) = A+B to the input nodes element-wise.
- Parameters:
left_node – The first input node for add operation.
right_node – The second input node for add operation.
auto_broadcast – The type of broadcasting specifies rules used for auto-broadcasting of input tensors. Defaults to “NUMPY”.
name – The optional name for output new node.
- Returns:
The node performing element-wise addition.
- __class__#
alias of
pybind11_type
- __delattr__(name, /)#
Implement delattr(self, name).
- __dir__()#
Default dir() implementation.
- __div__(right_node: Node | int | float | ndarray, auto_broadcast: str = 'NUMPY', name: str | None = None) Node #
Return node which applies f(x) = A/B to the input nodes element-wise.
- Parameters:
left_node – The node providing dividend data.
right_node – The node providing divisor data.
auto_broadcast – Specifies rules used for auto-broadcasting of input tensors.
name – Optional name for output node.
- Returns:
The node performing element-wise division.
- __eq__(right_node: Node | int | float | ndarray, auto_broadcast: str = 'NUMPY', name: str | None = None) Node #
Return node which checks if input nodes are equal element-wise.
- Parameters:
left_node – The first input node for equal operation.
right_node – The second input node for equal operation.
auto_broadcast – The type of broadcasting specifies rules used for auto-broadcasting of input tensors.
name – The optional name for output new node.
- Returns:
The node performing element-wise equality check.
- __format__(format_spec, /)#
Default object formatter.
- __ge__(right_node: Node | int | float | ndarray, auto_broadcast: str = 'NUMPY', name: str | None = None) Node #
Return node which checks if left node is greater or equal to the right node element-wise.
- Parameters:
left_node – The first input node providing data.
right_node – The second input node providing data.
auto_broadcast – The type of broadcasting specifies rules used for auto-broadcasting of input tensors.
name – The optional new name for output node.
- Returns:
The node performing element-wise check whether left_node is greater than or equal right_node.
- __getattr__(self: openvino._pyopenvino.Node, arg0: str) Callable #
- __getattribute__(name, /)#
Return getattr(self, name).
- __gt__(right_node: Node | int | float | ndarray, auto_broadcast: str = 'NUMPY', name: str | None = None) Node #
Return node which checks if left input node is greater than the right node element-wise.
- Parameters:
left_node – The first input node providing data.
right_node – The second input node providing data.
auto_broadcast – The type of broadcasting specifies rules used for auto-broadcasting of input tensors.
name – The optional new name for output node.
- Returns:
The node performing element-wise check whether left_node is greater than right_node.
- __hash__()#
Return hash(self).
- __init__(*args, **kwargs)#
Overloaded function.
__init__(self: openvino._pyopenvino.op.if_op) -> None
__init__(self: openvino._pyopenvino.op.if_op, execution_condition: ov::Output<ov::Node>) -> None
Constructs If with condition.
- param execution_condition:
condition node.
- type execution_condition:
openvino.runtime.Output
- rtype:
openvino.impl.op.If
__init__(self: openvino._pyopenvino.op.if_op, execution_condition: openvino._pyopenvino.Node) -> None
Constructs If with condition.
- param execution_condition:
condition node.
- type execution_condition:
openvino.runtime.Node
- rtype:
openvino.impl.op.If
- __init_subclass__()#
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
- __le__(right_node: Node | int | float | ndarray, auto_broadcast: str = 'NUMPY', name: str | None = None) Node #
Return node which checks if left input node is less or equal the right node element-wise.
- Parameters:
left_node – The first input node providing data.
right_node – The second input node providing data.
auto_broadcast – The type of broadcasting specifies rules used for auto-broadcasting of input tensors.
name – The optional new name for output node.
- Returns:
The node performing element-wise check whether left_node is less than or equal the right_node.
- __lt__(right_node: Node | int | float | ndarray, auto_broadcast: str = 'NUMPY', name: str | None = None) Node #
Return node which checks if left input node is less than the right node element-wise.
- Parameters:
left_node – The first input node providing data.
right_node – The second input node providing data.
auto_broadcast – The type of broadcasting specifies rules used for auto-broadcasting of input tensors.
name – The optional new name for output node.
- Returns:
The node performing element-wise check whether left_node is less than the right_node.
- __mul__(right_node: Node | int | float | ndarray, auto_broadcast: str = 'NUMPY', name: str | None = None) Node #
Return node which applies f(A,B) = A*B to the input nodes elementwise.
- Parameters:
left_node – The first input node for multiply operation.
right_node – The second input node for multiply operation.
auto_broadcast – The type of broadcasting specifies rules used for auto-broadcasting of input tensors. Defaults to “NUMPY”.
name – The optional name for output new node.
- Returns:
The node performing element-wise multiplication.
- __ne__(right_node: Node | int | float | ndarray, auto_broadcast: str = 'NUMPY', name: str | None = None) Node #
Return node which checks if input nodes are unequal element-wise.
- Parameters:
left_node – The first input node for not-equal operation.
right_node – The second input node for not-equal operation.
auto_broadcast – The type of broadcasting specifies rules used for auto-broadcasting of input tensors.
name – The optional name for output new node.
- Returns:
The node performing element-wise inequality check.
- __new__(**kwargs)#
- __radd__(right)#
- __rdiv__(right)#
- __reduce__()#
Helper for pickle.
- __reduce_ex__(protocol, /)#
Helper for pickle.
- __repr__(self: openvino._pyopenvino.op.if_op) str #
- __rmul__(right)#
- __rsub__(right)#
- __rtruediv__(right)#
- __setattr__(name, value, /)#
Implement setattr(self, name, value).
- __sizeof__()#
Size of object in memory, in bytes.
- __str__()#
Return str(self).
- __sub__(right_node: Node | int | float | ndarray, auto_broadcast: str = 'NUMPY', name: str | None = None) Node #
Return node which applies f(x) = A-B to the input nodes element-wise.
- Parameters:
left_node – The node providing data for left hand side of operator.
right_node – The node providing data for right hand side of operator.
auto_broadcast – The type of broadcasting that specifies mapping of input tensor axes to output shape axes. Range of values: numpy, explicit.
name – The optional name for output node.
- Returns:
The new output node performing subtraction operation on both tensors element-wise.
- __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).
- __truediv__(right_node: Node | int | float | ndarray, auto_broadcast: str = 'NUMPY', name: str | None = None) Node #
Return node which applies f(x) = A/B to the input nodes element-wise.
- Parameters:
left_node – The node providing dividend data.
right_node – The node providing divisor data.
auto_broadcast – Specifies rules used for auto-broadcasting of input tensors.
name – Optional name for output node.
- Returns:
The node performing element-wise division.
- constructor_validate_and_infer_types(self: openvino._pyopenvino.Node) None #
- evaluate(*args, **kwargs)#
Overloaded function.
evaluate(self: openvino._pyopenvino.Node, output_values: list[ov::Tensor], input_values: list[ov::Tensor], evaluationContext: openvino._pyopenvino.RTMap) -> bool
Evaluate the node on inputs, putting results in outputs
- param output_tensors:
Tensors for the outputs to compute. One for each result.
- type output_tensors:
List[openvino.runtime.Tensor]
- param input_tensors:
Tensors for the inputs. One for each inputs.
- type input_tensors:
List[openvino.runtime.Tensor]
- param evaluation_context:
Storage of additional settings and attributes that can be used
when evaluating the function. This additional information can be shared across nodes. :type evaluation_context: openvino.runtime.RTMap :rtype: bool
evaluate(self: openvino._pyopenvino.Node, output_values: list[ov::Tensor], input_values: list[ov::Tensor]) -> bool
Evaluate the function on inputs, putting results in outputs
- param output_tensors:
Tensors for the outputs to compute. One for each result.
- type output_tensors:
List[openvino.runtime.Tensor]
- param input_tensors:
Tensors for the inputs. One for each inputs.
- type input_tensors:
List[openvino.runtime.Tensor]
- rtype:
bool
- property friendly_name#
- get_attributes(self: openvino._pyopenvino.Node) dict #
- get_element_type(self: openvino._pyopenvino.Node) openvino._pyopenvino.Type #
Checks that there is exactly one output and returns it’s element type.
- Returns:
Type of the output.
- Return type:
- get_else_body(self: openvino._pyopenvino.op.if_op) object #
Gets else_body as Model object.
- Returns:
else_body as Model object.
- Return type:
- get_friendly_name(self: openvino._pyopenvino.Node) str #
Gets the friendly name for a node. If no friendly name has been set via set_friendly_name then the node’s unique name is returned.
- Returns:
Friendly name of the node.
- Return type:
str
- get_function(self: openvino._pyopenvino.op.if_op, index: int) object #
Gets internal sub-graph by index in MultiSubGraphOp.
- Parameters:
index (int) – sub-graph’s index in op.
- Returns:
Model with sub-graph.
- Return type:
- get_input_descriptions(self: openvino._pyopenvino.op.if_op, index: int) list #
Gets list with connections between operation inputs and internal sub-graph parameters.
- Parameters:
index (int) – index of internal sub-graph.
- Returns:
list of input descriptions.
- Return type:
list[Union[openvino.runtime.op.util.MergedInputDescription, openvino.runtime.op.util.InvariantInputDescription, openvino.runtime.op.util.SliceInputDescription]]
- get_input_element_type(self: openvino._pyopenvino.Node, index: int) openvino._pyopenvino.Type #
Returns the element type for input index
- Parameters:
index (int) – Index of the input.
- Returns:
Type of the input index
- Return type:
- get_input_partial_shape(self: openvino._pyopenvino.Node, index: int) openvino._pyopenvino.PartialShape #
Returns the partial shape for input index
- Parameters:
index (int) – Index of the input.
- Returns:
PartialShape of the input index
- Return type:
- get_input_shape(self: openvino._pyopenvino.Node, index: int) openvino._pyopenvino.Shape #
Returns the shape for input index
- Parameters:
index (int) – Index of the input.
- Returns:
Shape of the input index
- Return type:
- get_input_size(self: openvino._pyopenvino.Node) int #
Returns the number of inputs to the node.
- Returns:
Number of inputs.
- Return type:
int
- get_input_tensor(self: openvino._pyopenvino.Node, index: int) ov::descriptor::Tensor #
Returns the tensor for the node’s input with index i
- Parameters:
index (int) – Index of Input.
- Returns:
Tensor of the input index
- Return type:
openvino._pyopenvino.DescriptorTensor
- get_instance_id(self: openvino._pyopenvino.Node) int #
Returns id of the node. May be used to compare nodes if they are same instances.
- Returns:
id of the node.
- Return type:
int
- get_name(self: openvino._pyopenvino.Node) str #
Get the unique name of the node
- Returns:
Unique name of the node.
- Return type:
str
- get_output_descriptions(self: openvino._pyopenvino.op.if_op, index: int) list #
Gets list with connections between operation outputs and internal sub-graph parameters.
- Parameters:
index (int) – index of internal sub-graph.
- Returns:
list of output descriptions.
- Return type:
list[Union[openvino.runtime.op.util.BodyOutputDescription, openvino.runtime.op.util.ConcatOutputDescription]]
- get_output_element_type(self: openvino._pyopenvino.Node, index: int) openvino._pyopenvino.Type #
Returns the element type for output index
- Parameters:
index (int) – Index of the output.
- Returns:
Type of the output index
- Return type:
- get_output_partial_shape(self: openvino._pyopenvino.Node, index: int) openvino._pyopenvino.PartialShape #
Returns the partial shape for output index
- Parameters:
index (int) – Index of the output.
- Returns:
PartialShape of the output index
- Return type:
- get_output_shape(self: openvino._pyopenvino.Node, index: int) openvino._pyopenvino.Shape #
Returns the shape for output index
- Parameters:
index (int) – Index of the output.
- Returns:
Shape of the output index
- Return type:
- get_output_size(self: openvino._pyopenvino.Node) int #
Returns the number of outputs from the node.
- Returns:
Number of outputs.
- Return type:
int
- get_output_tensor(self: openvino._pyopenvino.Node, index: int) ov::descriptor::Tensor #
Returns the tensor for output index
- Parameters:
index (int) – Index of the output.
- Returns:
Tensor of the output index
- Return type:
openvino._pyopenvino.DescriptorTensor
- get_rt_info(self: openvino._pyopenvino.Node) openvino._pyopenvino.RTMap #
Returns PyRTMap which is a dictionary of user defined runtime info.
- Returns:
A dictionary of user defined data.
- Return type:
- get_then_body(self: openvino._pyopenvino.op.if_op) object #
Gets then_body as Model object.
- Returns:
then_body as Model object.
- Return type:
- get_type_info(self: openvino._pyopenvino.Node) ov::DiscreteTypeInfo #
- get_type_name(self: openvino._pyopenvino.Node) str #
Returns Type’s name from the node.
- Returns:
String representing Type’s name.
- Return type:
str
- input(self: openvino._pyopenvino.Node, input_index: int) ov::Input<ov::Node> #
A handle to the input_index input of this node.
- Parameters:
input_index (int) – Index of Input.
- Returns:
Input of this node.
- Return type:
- input_value(self: openvino._pyopenvino.Node, index: int) ov::Output<ov::Node> #
Returns input of the node with index i
- Parameters:
index (int) – Index of Input.
- Returns:
Input of this node.
- Return type:
- input_values(self: openvino._pyopenvino.Node) list[ov::Output<ov::Node>] #
Returns list of node’s inputs, in order.
- Returns:
List of node’s inputs
- Return type:
List[openvino.runtime.Input]
- inputs(self: openvino._pyopenvino.Node) list[ov::Input<ov::Node>] #
A list containing a handle for each of this node’s inputs, in order.
- Returns:
List of node’s inputs.
- Return type:
List[openvino.runtime.Input]
- property name#
- output(self: openvino._pyopenvino.Node, output_index: int) ov::Output<ov::Node> #
A handle to the output_index output of this node.
- Parameters:
output_index (int) – Index of Output.
- Returns:
Output of this node.
- Return type:
- outputs(self: openvino._pyopenvino.Node) list[ov::Output<ov::Node>] #
A list containing a handle for each of this node’s outputs, in order.
- Returns:
List of node’s outputs.
- Return type:
List[openvino.runtime.Output]
- property rt_info#
- set_argument(self: openvino._pyopenvino.Node, arg0: int, arg1: ov::Output<ov::Node>) None #
- set_arguments(*args, **kwargs)#
Overloaded function.
set_arguments(self: openvino._pyopenvino.Node, arg0: list[openvino._pyopenvino.Node]) -> None
set_arguments(self: openvino._pyopenvino.Node, arg0: list[ov::Output<ov::Node>]) -> None
- set_attribute(self: openvino._pyopenvino.Node, arg0: str, arg1: object) None #
- set_else_body(self: openvino._pyopenvino.op.if_op, body: ov::Model) None #
Sets new Model object as new else_body.
- Parameters:
body (openvino.Model) – new body for ‘else’ branch.
- Return type:
None
- set_friendly_name(self: openvino._pyopenvino.Node, name: str) None #
Sets a friendly name for a node. This does not overwrite the unique name of the node and is retrieved via get_friendly_name(). Used mainly for debugging. The friendly name may be set exactly once.
- Parameters:
name (str) – Friendly name to set.
- set_function(self: openvino._pyopenvino.op.if_op, index: int, func: ov::Model) None #
Adds sub-graph to MultiSubGraphOp.
- Parameters:
index (int) – index of new sub-graph.
func (openvino.Model) – func new sub_graph as a Model.
- Return type:
None
- set_input(self: openvino._pyopenvino.op.if_op, value: ov::Output<ov::Node>, then_parameter: openvino._pyopenvino.op.Parameter, else_parameter: openvino._pyopenvino.op.Parameter) None #
Sets new input to the operation associated with parameters of each sub-graphs.
- Parameters:
value (openvino.runtime.Output) – input to operation.
then_result (openvino.runtime.Node) – parameter for then_body or nullptr.
else_result (openvino.runtime.Node) – parameter for else_body or nullptr.
- Return type:
None
- set_input_descriptions(self: openvino._pyopenvino.op.if_op, index: int, inputs: list) None #
Sets list with connections between operation inputs and internal sub-graph parameters.
- Parameters:
index (int) – index of internal sub-graph.
inputs (list[Union[openvino.runtime.op.util.MergedInputDescription, openvino.runtime.op.util.InvariantInputDescription, openvino.runtime.op.util.SliceInputDescription]]) – list of input descriptions.
- Return type:
None
- set_output(self: openvino._pyopenvino.op.if_op, then_result: openvino._pyopenvino.op.Result, else_result: openvino._pyopenvino.op.Result) ov::Output<ov::Node> #
Sets new output from the operation associated with results of each sub-graphs.
- Parameters:
- Returns:
output from operation.
- Return type:
- set_output_descriptions(self: openvino._pyopenvino.op.if_op, index: int, outputs: list) None #
Sets list with connections between operation outputs and internal sub-graph parameters.
- Parameters:
index (int) – index of internal sub-graph.
outputs (list[Union[openvino.runtime.op.util.BodyOutputDescription, openvino.runtime.op.util.ConcatOutputDescription]]) – list of output descriptions.
- Return type:
None
- set_output_size(self: openvino._pyopenvino.Node, size: int) None #
Sets the number of outputs
- Parameters:
size (int) – number of outputs.
- set_output_type(self: openvino._pyopenvino.Node, index: int, element_type: openvino._pyopenvino.Type, shape: openvino._pyopenvino.PartialShape) None #
Sets output’s element type and shape.
- Parameters:
index (int) – Index of the output.
element_type (openvino.Type) – Element type of the output.
shape (openvino.PartialShape) – Shape of the output.
- set_then_body(self: openvino._pyopenvino.op.if_op, body: ov::Model) None #
Sets new Model object as new then_body.
- Parameters:
body (openvino.Model) – new body for ‘then’ branch.
- Return type:
None
- property shape#
- property type_info#
- validate_and_infer_types(self: openvino._pyopenvino.Node) None #
Verifies that attributes and inputs are consistent and computes output shapes and element types. Must be implemented by concrete child classes so that it can be run any number of times.
Throws if the node is invalid.