Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[PyOV] Update Python API stub files (#33031)

sys-openvino-cieda153698891
diff --git a/src/bindings/python/src/openvino/_ov_api.pyi b/src/bindings/python/src/openvino/_ov_api.pyi
index 66133d53716..fcda24ea338 100644
--- a/src/bindings/python/src/openvino/_ov_api.pyi
+++ b/src/bindings/python/src/openvino/_ov_api.pyi
@@ -93,13 +93,19 @@ class AsyncInferQueue(openvino._pyopenvino.AsyncInferQueue):
If set to `True` the data dispatcher tries to provide "zero-copy"
Tensors for every input in form of:
- * `numpy.ndarray` and all the types that are castable to it, e.g. `torch.Tensor`
+
+ * `numpy.ndarray` and all the types that are castable to it,
+ e.g. `torch.Tensor`
+
Data that is going to be copied:
- * `numpy.ndarray` which are not C contiguous and/or not writable (WRITEABLE flag is set to False)
+
+ * `numpy.ndarray` which are not C contiguous and/or not writable
+ (WRITEABLE flag is set to False)
* inputs which data types are mismatched from Infer Request's inputs
* inputs that should be in `BF16` data type
* scalar inputs (i.e. `np.float_`/`str`/`bytes`/`int`/`float`)
* lists of simple data types (i.e. `str`/`bytes`/`int`/`float`)
+
Keeps Tensor inputs "as-is".
Note: Use with extra care, shared data can be modified during runtime!
@@ -157,13 +163,19 @@ class CompiledModel(openvino._pyopenvino.CompiledModel):
If set to `True` the data dispatcher tries to provide "zero-copy"
Tensors for every input in form of:
- * `numpy.ndarray` and all the types that are castable to it, e.g. `torch.Tensor`
+
+ * `numpy.ndarray` and all the types that are castable to it,
+ e.g. `torch.Tensor`
+
Data that is going to be copied:
- * `numpy.ndarray` which are not C contiguous and/or not writable (WRITEABLE flag is set to False)
+
+ * `numpy.ndarray` which are not C contiguous and/or not writable
+ (WRITEABLE flag is set to False)
* inputs which data types are mismatched from Infer Request's inputs
* inputs that should be in `BF16` data type
* scalar inputs (i.e. `np.float_`/`str`/`bytes`/`int`/`float`)
* lists of simple data types (i.e. `str`/`bytes`/`int`/`float`)
+
Keeps Tensor inputs "as-is".
Note: Use with extra care, shared data can be modified during runtime!
@@ -386,13 +398,19 @@ class InferRequest(openvino.utils.data_helpers.wrappers._InferRequestWrapper):
If set to `True` the data dispatcher tries to provide "zero-copy"
Tensors for every input in form of:
- * `numpy.ndarray` and all the types that are castable to it, e.g. `torch.Tensor`
+
+ * `numpy.ndarray` and all the types that are castable to it,
+ e.g. `torch.Tensor`
+
Data that is going to be copied:
- * `numpy.ndarray` which are not C contiguous and/or not writable (WRITEABLE flag is set to False)
+
+ * `numpy.ndarray` which are not C contiguous and/or not writable
+ (WRITEABLE flag is set to False)
* inputs which data types are mismatched from Infer Request's inputs
* inputs that should be in `BF16` data type
* scalar inputs (i.e. `np.float_`/`str`/`bytes`/`int`/`float`)
* lists of simple data types (i.e. `str`/`bytes`/`int`/`float`)
+
Keeps Tensor inputs "as-is".
Note: Use with extra care, shared data can be modified during runtime!
@@ -461,13 +479,19 @@ class InferRequest(openvino.utils.data_helpers.wrappers._InferRequestWrapper):
If set to `True` the data dispatcher tries to provide "zero-copy"
Tensors for every input in form of:
- * `numpy.ndarray` and all the types that are castable to it, e.g. `torch.Tensor`
+
+ * `numpy.ndarray` and all the types that are castable to it,
+ e.g. `torch.Tensor`
+
Data that is going to be copied:
- * `numpy.ndarray` which are not C contiguous and/or not writable (WRITEABLE flag is set to False)
+
+ * `numpy.ndarray` which are not C contiguous and/or not writable
+ (WRITEABLE flag is set to False)
* inputs which data types are mismatched from Infer Request's inputs
* inputs that should be in `BF16` data type
* scalar inputs (i.e. `np.float_`/`str`/`bytes`/`int`/`float`)
* lists of simple data types (i.e. `str`/`bytes`/`int`/`float`)
+
Keeps Tensor inputs "as-is".
Note: Use with extra care, shared data can be modified during runtime!
diff --git a/src/bindings/python/src/openvino/frontend/tensorflow/__init__.pyi b/src/bindings/python/src/openvino/frontend/tensorflow/__init__.pyi
index 3edc7867e7c..977eeedacfd 100644
--- a/src/bindings/python/src/openvino/frontend/tensorflow/__init__.pyi
+++ b/src/bindings/python/src/openvino/frontend/tensorflow/__init__.pyi
@@ -1,6 +1,5 @@
# type: ignore
from . import py_tensorflow_frontend
-from . import utils
from __future__ import annotations
from openvino.frontend.tensorflow.py_tensorflow_frontend import ConversionExtensionTensorflow as ConversionExtension
from openvino.frontend.tensorflow.py_tensorflow_frontend import OpExtensionTensorflow as OpExtension
@@ -10,4 +9,4 @@ from openvino.frontend.tensorflow.py_tensorflow_frontend import _FrontEndPyGraph
Package: openvino
Low level wrappers for the FrontEnd C++ API.
"""
-__all__: list[str] = ['ConversionExtension', 'GraphIterator', 'OpExtension', 'py_tensorflow_frontend', 'utils']
+__all__: list[str] = ['ConversionExtension', 'GraphIterator', 'OpExtension', 'py_tensorflow_frontend']
diff --git a/src/bindings/python/src/openvino/frontend/tensorflow/utils.pyi b/src/bindings/python/src/openvino/frontend/tensorflow/utils.pyi
deleted file mode 100644
index 3c6490c3d64..00000000000
--- a/src/bindings/python/src/openvino/frontend/tensorflow/utils.pyi
+++ /dev/null
@@ -1,74 +0,0 @@
-# type: ignore
-from __future__ import annotations
-from openvino._pyopenvino import Dimension
-from openvino._pyopenvino import PartialShape
-from openvino._pyopenvino import Type
-from packaging.version import Version
-from packaging.version import parse
-import logging as log
-import numpy as np
-import openvino._pyopenvino
-import sys as sys
-__all__: list[str] = ['Dimension', 'PartialShape', 'Type', 'Version', 'create_generic_function_from_keras_model', 'create_tf_graph_iterator', 'extract_model_graph', 'get_concrete_func', 'get_environment_setup', 'get_imported_module_version', 'get_input_spec_from_model', 'get_signature_from_input', 'get_signature_from_input_signature', 'get_static_shape', 'is_variable', 'log', 'model_is_graph_iterator', 'np', 'parse', 'partial_shape_to_list', 'sys', 'tf_type_to_ov_type', 'trace_tf_model', 'trace_tf_model_if_needed', 'type_supported_by_tf_fe']
-def create_generic_function_from_keras_model(keras_model):
- ...
-def create_tf_graph_iterator(input_model, placeholder_shapes, placeholder_data_types, example_input, share_weights):
- ...
-def extract_model_graph(argv):
- ...
-def get_concrete_func(tf_function, example_input, input_needs_packing, error_message, use_example_input = True):
- """
-
- Runs tracing of TF function and returns a concrete function.
-
- :param tf_function: TF function that needs to be traced.
- :param example_input: Example of function input.
- :param input_needs_packing: determines if input needs to be packed in a list before passing to TF function.
- It is used when original function was wrapped in outer TF function, which changes function signature.
- In this case wrapper TF function always expects list of inputs which are unpacked inside subfunction.
- So list/tuple are treated as multiple inputs of original model.
- Non list/tuple are treated as single input, and it needs packing to a list,
- as wrapper function always expect list of inputs.
- :param error_message: Error message which should be shown in case of tracing error.
- :param use_example_input: Determines if example_input should be used.
-
- :returns: Object of type tf.types.experimental.ConcreteFunction.
-
- """
-def get_environment_setup(framework):
- """
-
- Get environment setup such as Python version, TensorFlow version
- :param framework: framework name
- :return: a dictionary of environment variables
-
- """
-def get_imported_module_version(imported_module):
- """
-
- Get imported module version
- :return: version(str) or raise AttributeError exception
-
- """
-def get_input_spec_from_model(model, input_shapes = None):
- ...
-def get_signature_from_input(keras_model):
- ...
-def get_signature_from_input_signature(keras_model):
- ...
-def get_static_shape(shape: [openvino._pyopenvino.PartialShape, list, tuple], dynamic_value = None):
- ...
-def is_variable(func_input, captures):
- ...
-def model_is_graph_iterator(model):
- ...
-def partial_shape_to_list(partial_shape: openvino._pyopenvino.PartialShape):
- ...
-def tf_type_to_ov_type(val):
- ...
-def trace_tf_model(model, input_shapes, input_types, example_input):
- ...
-def trace_tf_model_if_needed(input_model, placeholder_shapes, placeholder_data_types, example_input):
- ...
-def type_supported_by_tf_fe(input_model):
- ...
diff --git a/src/bindings/python/src/openvino/opset13/ops.pyi b/src/bindings/python/src/openvino/opset13/ops.pyi
index f605250fe35..25a17fb50fe 100644
--- a/src/bindings/python/src/openvino/opset13/ops.pyi
+++ b/src/bindings/python/src/openvino/opset13/ops.pyi
@@ -35,7 +35,8 @@ def bitwise_and(left, right, *args, **kwargs) -> openvino._pyopenvino.Node:
:param left_node: Tensor of integer or boolean datatype providing data.
:param right_node: Tensor of integer or boolean datatype providing data.
- :param auto_broadcast: The type of broadcasting specifies rules used for auto-broadcasting of input tensors. Defaults to “NUMPY”.
+ :param auto_broadcast: The type of broadcasting specifies rules used for
+ auto-broadcasting of input tensors. Defaults to "NUMPY".
:param name: The optional new name for output node.
:return: The node performing bitwise AND operation on input nodes corresponding elements.
@@ -59,7 +60,8 @@ def bitwise_or(left, right, *args, **kwargs) -> openvino._pyopenvino.Node:
:param left_node: Tensor of integer or boolean datatype providing data.
:param right_node: Tensor of integer or boolean datatype providing data.
- :param auto_broadcast: The type of broadcasting specifies rules used for auto-broadcasting of input tensors. Defaults to “NUMPY”.
+ :param auto_broadcast: The type of broadcasting specifies rules used for
+ auto-broadcasting of input tensors. Defaults to "NUMPY".
:param name: The optional new name for output node.
:return: The node performing bitwise OR operation on input nodes corresponding elements.
@@ -72,7 +74,8 @@ def bitwise_xor(left, right, *args, **kwargs) -> openvino._pyopenvino.Node:
:param left_node: Tensor of integer or boolean datatype providing data.
:param right_node: Tensor of integer or boolean datatype providing data.
- :param auto_broadcast: The type of broadcasting specifies rules used for auto-broadcasting of input tensors. Defaults to “NUMPY”.
+ :param auto_broadcast: The type of broadcasting specifies rules used for
+ auto-broadcasting of input tensors. Defaults to "NUMPY".
:param name: The optional new name for output node.
:return: The node performing bitwise XOR operation on input nodes corresponding elements.
@@ -149,15 +152,19 @@ def nms_rotated(*args, **kwargs) -> openvino._pyopenvino.Node:
"""
Return a node which performs NMSRotated.
- :param boxes: Tensor with box coordinates of floating point type and shape [num_batches, num_boxes, 5],
- where the last dimension is defined as [x_ctr, y_ctr, width, height, angle_radians].
- :param scores: Tensor with box scores of floating point type and shape [num_batches, num_classes, num_boxes].
- :param max_output_boxes_per_class: Tensor (scalar or 1D) of integer type, specifying maximum number of boxes
- to be selected per class.
- :param iou_threshold: Tensor (scalar or 1D) of floating point type, specifying intersection over union threshold
- :param score_threshold: Tensor (scalar or 1D) of floating point type, specifying minimum score to consider box for the processing.
- :param sort_result_descending: Flag that specifies whenever it is necessary to sort selected
- boxes across batches or not.
+ :param boxes: Tensor with box coordinates of floating point type and shape
+ [num_batches, num_boxes, 5], where the last dimension is defined as
+ [x_ctr, y_ctr, width, height, angle_radians].
+ :param scores: Tensor with box scores of floating point type and shape
+ [num_batches, num_classes, num_boxes].
+ :param max_output_boxes_per_class: Tensor (scalar or 1D) of integer type, specifying
+ maximum number of boxes to be selected per class.
+ :param iou_threshold: Tensor (scalar or 1D) of floating point type, specifying
+ intersection over union threshold
+ :param score_threshold: Tensor (scalar or 1D) of floating point type, specifying
+ minimum score to consider box for the processing.
+ :param sort_result_descending: Flag that specifies whenever it is necessary to sort
+ selected boxes across batches or not.
:param output_type: Output element type.
:param clockwise: Flag that specifies direction of the box rotation.
:return: The new node which performs NMSRotated
diff --git a/src/bindings/python/src/openvino/opset14/ops.pyi b/src/bindings/python/src/openvino/opset14/ops.pyi
index e76c99c6ff3..9d43678a046 100644
--- a/src/bindings/python/src/openvino/opset14/ops.pyi
+++ b/src/bindings/python/src/openvino/opset14/ops.pyi
@@ -40,9 +40,12 @@ def convert_promote_types(*args, **kwargs) -> openvino._pyopenvino.Node:
:param left_node: input node with type to be promoted to common one.
:param right_node: input node with type to be promoted to common one.
- :param promote_unsafe: Bool attribute whether to allow promotions that might result in bit-widening, precision loss and undefined behaviors.
- :param pytorch_scalar_promotion: Bool attribute whether to promote scalar input to type provided by non-scalar input when number format is matching.
- :param u64_integer_promotion_target: Element type attribute to select promotion result when inputs are u64 and signed integer.
+ :param promote_unsafe: Bool attribute whether to allow promotions that might result
+ in bit-widening, precision loss and undefined behaviors.
+ :param pytorch_scalar_promotion: Bool attribute whether to promote scalar input to type
+ provided by non-scalar input when number format is matching.
+ :param u64_integer_promotion_target: Element type attribute to select promotion result
+ when inputs are u64 and signed integer.
:param name: Optional name for the new output node.
:return: The new node performing ConvertPromoteTypes operation.
diff --git a/src/bindings/python/src/openvino/opset16/ops.pyi b/src/bindings/python/src/openvino/opset16/ops.pyi
index e9dd9da34cc..01bc8a5713a 100644
--- a/src/bindings/python/src/openvino/opset16/ops.pyi
+++ b/src/bindings/python/src/openvino/opset16/ops.pyi
@@ -85,8 +85,10 @@ def segment_max(*args, **kwargs) -> openvino._pyopenvino.Node:
:param data: ND tensor of type T, the numerical data on which SegmentMax operation will be performed.
:param segment_ids: 1D Tensor of sorted non-negative numbers, representing the segments.
- :param num_segments: An optional scalar value representing the segments count. If not provided, it is inferred from segment_ids.
- :param fill_mode: Responsible for the value assigned to segments which are empty. Can be "ZERO" or "LOWEST".
+ :param num_segments: An optional scalar value representing the segments count.
+ If not provided, it is inferred from segment_ids.
+ :param fill_mode: Responsible for the value assigned to segments which are empty.
+ Can be "ZERO" or "LOWEST".
:param name: Optional name for the node.
:return: The new node performing SegmentMax operation.
diff --git a/src/bindings/python/src/openvino/opset9/ops.pyi b/src/bindings/python/src/openvino/opset9/ops.pyi
index 2f608f7c637..67669cedc44 100644
--- a/src/bindings/python/src/openvino/opset9/ops.pyi
+++ b/src/bindings/python/src/openvino/opset9/ops.pyi
@@ -40,9 +40,12 @@ def generate_proposals(*args, **kwargs) -> openvino._pyopenvino.Node:
:param nms_threshold: Specifies threshold to be used in the NMS stage.
:param pre_nms_count: Specifies number of top-n proposals before NMS.
:param post_nms_count: Specifies number of top-n proposals after NMS.
- :param normalized: Specifies whether proposal bboxes are normalized or not. Optional attribute, default value is `True`.
- :param nms_eta: Specifies eta parameter for adaptive NMS., must be in range `[0.0, 1.0]`. Optional attribute, default value is `1.0`.
- :param roi_num_type: Specifies the element type of the third output `rpnroisnum`. Optional attribute, range of values: `i64` (default) or `i32`.
+ :param normalized: Specifies whether proposal bboxes are normalized or not.
+ Optional attribute, default value is `True`.
+ :param nms_eta: Specifies eta parameter for adaptive NMS., must be in range `[0.0, 1.0]`.
+ Optional attribute, default value is `1.0`.
+ :param roi_num_type: Specifies the element type of the third output `rpnroisnum`.
+ Optional attribute, range of values: `i64` (default) or `i32`.
:param name: The optional name for the output node.
:return: New node performing GenerateProposals operation.
diff --git a/src/bindings/python/src/openvino/package_utils.pyi b/src/bindings/python/src/openvino/package_utils.pyi
index a7d571eea0f..51b332df5cd 100644
--- a/src/bindings/python/src/openvino/package_utils.pyi
+++ b/src/bindings/python/src/openvino/package_utils.pyi
@@ -35,7 +35,9 @@ def classproperty(func: typing.Any) -> _ClassPropertyDescriptor:
...
def deprecated(name: typing.Any = None, version: str = '', message: str = '', stacklevel: int = 2) -> collections.abc.Callable[..., typing.Any]:
"""
- Prints deprecation warning "{function_name} is deprecated and will be removed in version {version}. {message}" and runs the function.
+ Prints deprecation warning and runs the function.
+
+ "{function_name} is deprecated and will be removed in version {version}. {message}"
:param version: The version in which the code will be removed.
:param message: A message explaining why the function is deprecated and/or what to use instead.
diff --git a/src/bindings/python/src/openvino/tools/ovc/convert_impl.pyi b/src/bindings/python/src/openvino/tools/ovc/convert_impl.pyi
index cd2674bd361..d6e317401ff 100644
--- a/src/bindings/python/src/openvino/tools/ovc/convert_impl.pyi
+++ b/src/bindings/python/src/openvino/tools/ovc/convert_impl.pyi
@@ -8,9 +8,6 @@ from openvino._pyopenvino import PartialShape
from openvino._pyopenvino import TelemetryExtension
from openvino._pyopenvino import get_version as get_rt_version
from openvino.frontend.frontend import FrontEndManager
-from openvino.frontend.tensorflow.utils import create_tf_graph_iterator
-from openvino.frontend.tensorflow.utils import extract_model_graph
-from openvino.frontend.tensorflow.utils import type_supported_by_tf_fe
from openvino.tools.ovc.cli_parser import depersonalize
from openvino.tools.ovc.cli_parser import get_available_front_ends
from openvino.tools.ovc.cli_parser import get_common_cli_options
@@ -47,7 +44,7 @@ import os as os
import sys as sys
import traceback as traceback
import tracemalloc as tracemalloc
-__all__: list[str] = ['Callable', 'Error', 'FrameworkError', 'FrontEndManager', 'Iterable', 'OpConversionFailure', 'OrderedDict', 'PartialShape', 'Path', 'TelemetryExtension', 'VersionChecker', 'add_line_breaks', 'any_extensions_used', 'argparse', 'args_to_argv', 'arguments_post_parsing', 'backend_ga4', 'check_iterable', 'check_model_object', 'check_values_equal', 'create_tf_graph_iterator', 'datetime', 'depersonalize', 'driver', 'extract_input_info_from_example', 'extract_model_graph', 'filtered_extensions', 'get_available_front_ends', 'get_common_cli_options', 'get_compression_message', 'get_convert_model_help_specifics', 'get_jax_decoder', 'get_mo_convert_params', 'get_moc_frontends', 'get_non_default_params', 'get_pytorch_decoder', 'get_pytorch_decoder_for_model_on_disk', 'get_rt_version', 'init_logger', 'init_ovc_telemetry', 'input_model_is_object', 'input_to_input_cut_info', 'is_verbose', 'log', 'moc_emit_ir', 'moc_pipeline', 'normalize_inputs', 'os', 'pack_params_to_args_namespace', 'paddle_frontend_converter', 'parse_inputs', 'prepare_ir', 'print_argv', 'replace_ext', 'send_conversion_result', 'send_params_info', 'show_mo_convert_help', 'sys', 'tf_frontend_with_python_bindings_installed', 'tm', 'to_ov_type', 'traceback', 'tracemalloc', 'type_supported_by_tf_fe']
+__all__: list[str] = ['Callable', 'Error', 'FrameworkError', 'FrontEndManager', 'Iterable', 'OpConversionFailure', 'OrderedDict', 'PartialShape', 'Path', 'TelemetryExtension', 'VersionChecker', 'add_line_breaks', 'any_extensions_used', 'argparse', 'args_to_argv', 'arguments_post_parsing', 'backend_ga4', 'check_iterable', 'check_model_object', 'check_values_equal', 'datetime', 'depersonalize', 'driver', 'extract_input_info_from_example', 'filtered_extensions', 'get_available_front_ends', 'get_common_cli_options', 'get_compression_message', 'get_convert_model_help_specifics', 'get_jax_decoder', 'get_mo_convert_params', 'get_moc_frontends', 'get_non_default_params', 'get_pytorch_decoder', 'get_pytorch_decoder_for_model_on_disk', 'get_rt_version', 'init_logger', 'init_ovc_telemetry', 'input_model_is_object', 'input_to_input_cut_info', 'is_verbose', 'log', 'moc_emit_ir', 'moc_pipeline', 'normalize_inputs', 'os', 'pack_params_to_args_namespace', 'paddle_frontend_converter', 'parse_inputs', 'prepare_ir', 'print_argv', 'replace_ext', 'send_conversion_result', 'send_params_info', 'show_mo_convert_help', 'sys', 'tf_frontend_with_python_bindings_installed', 'tm', 'to_ov_type', 'traceback', 'tracemalloc']
def _convert(cli_parser: argparse.ArgumentParser, args, python_api_used):
...
def add_line_breaks(text: str, char_num: int, line_break: str):
diff --git a/src/bindings/python/src/openvino/utils/postponed_constant.pyi b/src/bindings/python/src/openvino/utils/postponed_constant.pyi
index 1e7c15cffe6..55423d2694c 100644
--- a/src/bindings/python/src/openvino/utils/postponed_constant.pyi
+++ b/src/bindings/python/src/openvino/utils/postponed_constant.pyi
@@ -15,7 +15,11 @@ import openvino._pyopenvino
__all__: list[str] = ['Callable', 'Op', 'PartialShape', 'PostponedConstant', 'Shape', 'Tensor', 'TensorVector', 'Type', 'cast', 'make_postponed_constant', 'overload']
class PostponedConstant(openvino._op_base.Op):
"""
- Postponed Constant is a way to materialize a big constant only when it is going to be serialized to IR and then immediately dispose.
+ Postponed Constant is a way to materialize a big constant.
+
+ This class materializes a big constant only when it is going to be serialized
+ to IR and then immediately disposes of it.
+
"""
def __init__(self, element_type: openvino._pyopenvino.Type, shape: openvino._pyopenvino.Shape, maker: collections.abc.Callable, name: typing.Optional[str] = None) -> None:
"""
@@ -25,8 +29,10 @@ class PostponedConstant(openvino._op_base.Op):
:type element_type: openvino.Type
:param shape: Shape of the constant.
:type shape: openvino.Shape
- :param maker: A callable that returns a Tensor or modifies the provided Tensor to represent the constant.
- Note: It's recommended to use a callable without arguments (returns Tensor) to avoid unnecessary tensor data copies.
+ :param maker: A callable that returns a Tensor or modifies the provided Tensor to
+ represent the constant.
+ Note: It's recommended to use a callable without arguments (returns Tensor)
+ to avoid unnecessary tensor data copies.
:type maker: Union[Callable[[], Tensor], Callable[[Tensor], None]]
:param name: Optional name for the constant.
:type name: Optional[str]