OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[PyOV] Remove leftover runtime mentions (#33438)
Przemyslaw Wysocki92b2b72349c3
diff --git a/docs/articles_en/openvino-workflow/model-preparation.rst b/docs/articles_en/openvino-workflow/model-preparation.rstindex 952b9729754..f4292d3a0f4 100644--- a/docs/articles_en/openvino-workflow/model-preparation.rst+++ b/docs/articles_en/openvino-workflow/model-preparation.rst@@ -291,5 +291,3 @@ follow:* :doc:`Post-training optimization <model-optimization-guide/quantizing-models-post-training>`* :doc:`Model inference in OpenVINO Runtime <running-inference>`--.. need to investigate python api article generation - api/ie_python_api/_autosummary/openvino.Model.html does not exist, api/ie_python_api/_autosummary/openvino.runtime.Model.html does.diff --git a/docs/sphinx_setup/api/ie_python_api/api.rst b/docs/sphinx_setup/api/ie_python_api/api.rstindex 0d85d0c9006..bf136ee7d1c 100644--- a/docs/sphinx_setup/api/ie_python_api/api.rst+++ b/docs/sphinx_setup/api/ie_python_api/api.rst@@ -71,6 +71,120 @@ OpenVINO Python APIopenvino.properties.streams+.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.op++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.op.util++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset1++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset2++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset3++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset4++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset5++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset6++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset7++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset8++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset9++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset10++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset11++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset12++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset13++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset14++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset15++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.opset16++.. autosummary::+ :toctree: _autosummary+ :template: custom-module-template.rst++ openvino.passes+.. autosummary:::toctree: _autosummary:template: custom-module-template.rstdiff --git a/samples/python/classification_sample_async/README.md b/samples/python/classification_sample_async/README.mdindex ca8e4e88039..4cd432e6d11 100644--- a/samples/python/classification_sample_async/README.md+++ b/samples/python/classification_sample_async/README.md@@ -18,10 +18,10 @@ The following Python API is used in the application:| Feature | API | Description || -------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------|-| Asynchronous Infer | [openvino.runtime.AsyncInferQueue](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.AsyncInferQueue.html), | Do asynchronous inference |-| | [openvino.runtime.AsyncInferQueue.set_callback](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.AsyncInferQueue.html#openvino.runtime.AsyncInferQueue.set_callback), | |-| | [openvino.runtime.AsyncInferQueue.start_async](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.AsyncInferQueue.html#openvino.runtime.AsyncInferQueue.start_async), | |-| | [openvino.runtime.AsyncInferQueue.wait_all](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.AsyncInferQueue.html#openvino.runtime.AsyncInferQueue.wait_all), | |-| | [openvino.runtime.InferRequest.results](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.InferRequest.html#openvino.runtime.InferRequest.results) | |+| Asynchronous Infer | [openvino.AsyncInferQueue](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.AsyncInferQueue.html), | Do asynchronous inference |+| | [openvino.AsyncInferQueue.set_callback](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.AsyncInferQueue.html#openvino.AsyncInferQueue.set_callback), | |+| | [openvino.AsyncInferQueue.start_async](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.AsyncInferQueue.html#openvino.AsyncInferQueue.start_async), | |+| | [openvino.AsyncInferQueue.wait_all](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.AsyncInferQueue.html#openvino.AsyncInferQueue.wait_all), | |+| | [openvino.InferRequest.results](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.InferRequest.html#openvino.InferRequest.results) | |Basic OpenVINO™ Runtime API is covered by [Hello Classification Python Sample](https://docs.openvino.ai/2025/get-started/learn-openvino/openvino-samples/hello-classification.html).diff --git a/samples/python/hello_classification/README.md b/samples/python/hello_classification/README.mdindex cb4cbf636bc..729affbb6a8 100644--- a/samples/python/hello_classification/README.md+++ b/samples/python/hello_classification/README.md@@ -18,12 +18,12 @@ The following Python API is used in the application:| Feature | API | Description || ------------------| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|-| Basic Infer Flow | [openvino.runtime.Core](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Core.html) , | |-| | [openvino.runtime.Core.read_model](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Core.html#openvino.runtime.Core.read_model), | |-| | [openvino.runtime.Core.compile_model](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Core.html#openvino.runtime.Core.compile_model) | Common API to do inference |-| Synchronous Infer | [openvino.runtime.CompiledModel.infer_new_request](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.CompiledModel.html#openvino.runtime.CompiledModel.infer_new_request), | Do synchronous inference |-| Model Operations | [openvino.runtime.Model.inputs](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.inputs), | Managing of model |-| | [openvino.runtime.Model.outputs](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.outputs), | |+| Basic Infer Flow | [openvino.Core](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Core.html) , | |+| | [openvino.Core.read_model](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Core.html#openvino.Core.read_model), | |+| | [openvino.Core.compile_model](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Core.html#openvino.Core.compile_model) | Common API to do inference |+| Synchronous Infer | [openvino.CompiledModel.infer_new_request](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.CompiledModel.html#openvino.CompiledModel.infer_new_request), | Do synchronous inference |+| Model Operations | [openvino.Model.inputs](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Model.html#openvino.Model.inputs), | Managing of model |+| | [openvino.Model.outputs](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Model.html#openvino.Model.outputs), | || Preprocessing | [openvino.preprocess.PrePostProcessor](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.preprocess.PrePostProcessor.html), | Set image of the original size as input for a model with other input size. || | [openvino.preprocess.InputTensorInfo.set_element_type](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.preprocess.PrePostProcessor.html#openvino.preprocess.InputTensorInfo.set_element_type), | Resize and layout conversions will be performed automatically by the corresponding plugin just before inference || | [openvino.preprocess.InputTensorInfo.set_layout](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.preprocess.PrePostProcessor.html#openvino.preprocess.InputTensorInfo.set_layout), | |diff --git a/samples/python/hello_query_device/README.md b/samples/python/hello_query_device/README.mdindex ae72cbb613c..62528b3a651 100644--- a/samples/python/hello_query_device/README.md+++ b/samples/python/hello_query_device/README.md@@ -15,6 +15,6 @@ The following Python API is used in the application:| Feature | API | Description || --------------| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|-| Basic | [openvino.runtime.Core](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Core.html) | Common API |-| Query Device | [openvino.runtime.Core.available_devices](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Core.html#openvino.runtime.Core.available_devices) , | Get device properties |+| Basic | [openvino.Core](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Core.html) | Common API |+| Query Device | [openvino.Core.available_devices](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Core.html#openvino.Core.available_devices) , | Get device properties |diff --git a/samples/python/hello_reshape_ssd/README.md b/samples/python/hello_reshape_ssd/README.mdindex 6148531312e..fceaa9b222c 100644--- a/samples/python/hello_reshape_ssd/README.md+++ b/samples/python/hello_reshape_ssd/README.md@@ -17,9 +17,9 @@ The following Python API is used in the application:| Feature | API | Description || -----------------| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------|-| Model Operations | [openvino.runtime.Model.reshape](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.reshape), | Managing of model |-| | [openvino.runtime.Model.input](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.input), | |-| | [openvino.runtime.Output.get_any_name](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Output.html#openvino.runtime.Output.get_any_name), | |-| | [openvino.runtime.PartialShape](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.PartialShape.html) | |+| Model Operations | [openvino.Model.reshape](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Model.html#openvino.Model.reshape), | Managing of model |+| | [openvino.Model.input](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Model.html#openvino.Model.input), | |+| | [openvino.Output.get_any_name](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Output.html#openvino.Output.get_any_name), | |+| | [openvino.PartialShape](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.PartialShape.html) | |Basic OpenVINO™ Runtime API is covered by [Hello Classification Python* Sample](https://docs.openvino.ai/2025/get-started/learn-openvino/openvino-samples/hello-classification.html).diff --git a/samples/python/model_creation_sample/README.md b/samples/python/model_creation_sample/README.mdindex 9d0ff68b5a0..7d54c37f2eb 100644--- a/samples/python/model_creation_sample/README.md+++ b/samples/python/model_creation_sample/README.md@@ -17,17 +17,17 @@ The following OpenVINO Python API is used in the application:| Feature | API | Description || ------------------| ----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|-| Model Operations | [openvino.runtime.Model](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Model.html) , | Managing of model |-| | [openvino.runtime.set_batch](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.set_batch.html) , | |-| | [openvino.runtime.Model.input](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.Model.html#openvino.runtime.Model.input) | |-| Opset operations | [openvino.runtime.op.Parameter](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.op.Parameter.html), | Description of a model topology using OpenVINO Python API |-| | [openvino.runtime.op.Constant](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.op.Constant.html) , | |-| | [openvino.runtime.opset8.convolution](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.opset8.convolution.html) , | |-| | [openvino.runtime.opset8.add](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.opset8.add.html) , | |-| | [openvino.runtime.opset1.max_pool](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.opset1.max_pool.html) , | |-| | [openvino.runtime.opset8.reshape](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.opset8.reshape.html) , | |-| | [openvino.runtime.opset8.matmul](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.opset8.matmul.html) , | |-| | [openvino.runtime.opset8.relu](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.opset8.relu.html) , | |-| | [openvino.runtime.opset8.softmax](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.runtime.opset8.softmax.html) | |+| Model Operations | [openvino.Model](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Model.html) , | Managing of model |+| | [openvino.set_batch](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.set_batch.html) , | |+| | [openvino.Model.input](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.Model.html#openvino.Model.input) | |+| Opset operations | [openvino.op.Parameter](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.op.Parameter.html), | Description of a model topology using OpenVINO Python API |+| | [openvino.op.Constant](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.op.Constant.html) , | |+| | [openvino.opset8.convolution](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.opset8.convolution.html) , | |+| | [openvino.opset8.add](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.opset8.add.html) , | |+| | [openvino.opset1.max_pool](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.opset1.max_pool.html) , | |+| | [openvino.opset8.reshape](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.opset8.reshape.html) , | |+| | [openvino.opset8.matmul](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.opset8.matmul.html) , | |+| | [openvino.opset8.relu](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.opset8.relu.html) , | |+| | [openvino.opset8.softmax](https://docs.openvino.ai/2025/api/ie_python_api/_autosummary/openvino.opset8.softmax.html) | |Basic OpenVINO™ Runtime API is covered by [Hello Classification Python* Sample](https://docs.openvino.ai/2025/get-started/learn-openvino/openvino-samples/hello-classification.html).diff --git a/src/bindings/python/docs/code_examples.md b/src/bindings/python/docs/code_examples.mdindex 7581d5c87d9..f837a12737b 100644--- a/src/bindings/python/docs/code_examples.md+++ b/src/bindings/python/docs/code_examples.md@@ -9,7 +9,7 @@ Instructions can be found in ["Building the OpenVINO™ Python API"](./build.md)General guide:* Snake case (also known as the *lower_case_with_underscores* style) is used across the codebase. That includes modules (`runtime`, `offline_transformations`), function names, and arguments/variables (`async_infer`, `wait`, `path_to_xml`).* Naming of classes is an exception to the above rule. The *CamelCase* style is used in this case, for example: `Core`, `InferRequest` or `AsyncInferQueue`.-* If bindings (explained later in the [Pure pybind11 solution](#pure-pybind11-solution) section) are created to expose existing C++ code, make them similar to their C++ counterparts, regarding both names and placement, for example, C++'s `ov::InferRequest` and Python's `openvino.runtime.InferRequest`. If alignment is not possible, try to describe your class/function/module as well as possible, such as the pair of `openvino.runtime.ConstOutput/openvino.runtime.Output` which relates to `ov::Output<const ov::Node>/ov::Output<ov::Node>`. This naming points out the functional difference between both classes - one is an immutable and the other a mutable version.+* If bindings (explained later in the [Pure pybind11 solution](#pure-pybind11-solution) section) are created to expose existing C++ code, make them similar to their C++ counterparts, regarding both names and placement, for example, C++'s `ov::InferRequest` and Python's `openvino.InferRequest`. If alignment is not possible, try to describe your class/function/module as well as possible, such as the pair of `openvino.ConstOutput/openvino.Output` which relates to `ov::Output<const ov::Node>/ov::Output<ov::Node>`. This naming points out the functional difference between both classes - one is an immutable and the other a mutable version.<!-- Pure Python solution describes Python based approach -->## Pure Python solution@@ -117,7 +117,7 @@ Navigate to the main project file responsible for creation of the whole packageAdd a new submodule by writing:```cpp-py::module mymodule = m.def_submodule("mymodule", "My first feature - openvino.runtime.mymodule");+py::module mymodule = m.def_submodule("mymodule", "My first feature - openvino.mymodule");```This is a shorthand way of adding new submodules which can later be used to extend the package. The mysterious `m` is actaully the main OpenVINO™ module called `pyopenvino` -- it is registered with `PYBIND11_MODULE(pyopenvino, m)` at the top of the "registering-point" file. Later imports from it are done by calling upon the `openvino._pyopenvino` package.@@ -168,7 +168,7 @@ cls.def(py::init<ov::Tensor&>(),MyTensor's constructor.:param tensor: `Tensor` to create new `MyTensor` from.- :type tensor: openvino.runtime.Tensor+ :type tensor: openvino.Tensor)");// This initialize use custom constructor, implemented via lambda@@ -213,7 +213,7 @@ mymodule.def("get_smile", []() {**Don't forget to rebuild the project** and test it out:```pythonimport openvino._pyopenvino.mymodule as mymodule-from openvino.runtime import Tensor, Type+from openvino import Tensor, Typea = mymodule.MyTensor([1,2,3])a.get_size()@@ -303,14 +303,14 @@ Notice that only functions with correct arguments are **not** throwing exceptionAlthough *pybind11* is a powerful tool, it is sometimes required (or simply easier and more efficent) to combine both approaches and utilize both languages to achive best results.### Making pybind11-based module/class visible in OpenVINO™ package-Let's move a new class from `openvino._pyopenvino.mymodule` to the actual package. Simply introduce a new import statement in the desired file. Let it be [`openvino/runtime/__init__.py`](./../src/openvino/runtime/__init__.py):+Let's move a new class from `openvino._pyopenvino.mymodule` to the actual package. Simply introduce a new import statement in the desired file. Let it be [`openvino/__init__.py`](./../src/openvino/__init__.py):```pythonfrom openvino._pyopenvino.mymodule import MyTensor```-Now, while importing `openvino`, a new class is accessible from the `runtime` level:+Now, while importing `openvino`, a new class is accessible:```python-import openvino.runtime as ov+import openvino as ovov.MyTensor>>> <class 'openvino._pyopenvino.mymodule.MyTensor'>```@@ -320,7 +320,7 @@ Same rule applies to whole modules and free functions. **This is a required step### Yet another Python layerAs mentioned earlier, it may be helpful to utilize Python in-between to achieve hard C++ feats in a more efficient way. Let's extend the previously created `say_hello` function a little bit.-First, create a new file in the [runtime directory](./../src/openvino/runtime/) and call it `mymodule_ext.py`. There are no strict rules for naming, just make sure the names are in good taste. Import the class here:+First, create a new file in the [openvino directory](./../src/openvino/) and call it `mymodule_ext.py`. There are no strict rules for naming, just make sure the names are in good taste. Import the class here:```pythonfrom openvino._pyopenvino.mymodule import MyTensor as MyTensorBase```@@ -359,12 +359,12 @@ class MyTensor(MyTensorBase):Finally, import it in the same place as in the previous section, but this time use the improved version:```python-from openvino.runtime.mymodule_ext import MyTensor+from openvino.mymodule_ext import MyTensor```**Don't forget to rebuild the project** and test it out:```python-import openvino.runtime as ov+import openvino as ova = ov.MyTensor([1,2,3]) # Notice that initializers are preserved from pybind classa.say_hello()