diff --git a/src/bindings/python/src/openvino/__init__.py b/src/bindings/python/src/openvino/__init__.py index 7643f742e0067d..69c678909b1c9e 100644 --- a/src/bindings/python/src/openvino/__init__.py +++ b/src/bindings/python/src/openvino/__init__.py @@ -7,7 +7,7 @@ # Required for Windows OS platforms # Note: always top-level try: - from openvino.package_utils import _add_openvino_libs_to_search_path + from openvino.utils import _add_openvino_libs_to_search_path _add_openvino_libs_to_search_path() except ImportError: pass @@ -17,47 +17,6 @@ # # This __init__.py forces checking of runtime modules to propagate errors. # # It is not compared with init files from openvino-dev package. # # - -# Openvino pybind bindings -from openvino._pyopenvino import AxisSet -from openvino._pyopenvino import AxisVector -from openvino._pyopenvino import ConstOutput -from openvino._pyopenvino import Coordinate -from openvino._pyopenvino import CoordinateDiff -from openvino._pyopenvino import DiscreteTypeInfo -from openvino._pyopenvino import Extension -from openvino._pyopenvino import ProfilingInfo -from openvino._pyopenvino import RTMap -from openvino._pyopenvino import Version -from openvino._pyopenvino import Symbol -from openvino._pyopenvino import Dimension -from openvino._pyopenvino import Input -from openvino._pyopenvino import Output -from openvino._pyopenvino import Node -from openvino._pyopenvino import Strides -from openvino._pyopenvino import PartialShape -from openvino._pyopenvino import Shape -from openvino._pyopenvino import Layout -from openvino._pyopenvino import Type -from openvino._pyopenvino import Tensor -from openvino._pyopenvino import OVAny -from openvino._pyopenvino import get_batch -from openvino._pyopenvino import set_batch -from openvino._pyopenvino import serialize -from openvino._pyopenvino import shutdown -from openvino._pyopenvino import save_model -from openvino._pyopenvino import layout_helpers -from openvino._pyopenvino import RemoteContext -from openvino._pyopenvino import RemoteTensor -from openvino._pyopenvino import Op - -# Import public classes from _ov_api -from openvino._ov_api import Model -from openvino._ov_api import Core -from openvino._ov_api import CompiledModel -from openvino._ov_api import InferRequest -from openvino._ov_api import AsyncInferQueue - # Import all public modules from openvino import runtime as runtime from openvino import frontend as frontend @@ -67,10 +26,36 @@ from openvino import utils as utils from openvino import properties as properties +# Import most important classes and functions from openvino.runtime +from openvino._ov_api import Model +from openvino._ov_api import Core +from openvino._ov_api import CompiledModel +from openvino._ov_api import InferRequest +from openvino._ov_api import AsyncInferQueue + +from openvino.runtime import Symbol +from openvino.runtime import Dimension +from openvino.runtime import Strides +from openvino.runtime import PartialShape +from openvino.runtime import Shape +from openvino.runtime import Layout +from openvino.runtime import Type +from openvino.runtime import Tensor +from openvino.runtime import OVAny + # Helper functions for openvino module -from openvino.utils.data_helpers import tensor_from_file +from openvino.runtime.utils.data_helpers import tensor_from_file from openvino._ov_api import compile_model +from openvino.runtime import get_batch +from openvino.runtime import set_batch +from openvino.runtime import serialize +from openvino.runtime import shutdown +from openvino.runtime import save_model +from openvino.runtime import layout_helpers +from openvino._pyopenvino import RemoteContext +from openvino._pyopenvino import RemoteTensor +from openvino._pyopenvino import Op # Import opsets from openvino import opset1 @@ -95,7 +80,7 @@ from openvino._pyopenvino import VASurfaceTensor # Set version for openvino package -from openvino._pyopenvino import get_version +from openvino.runtime import get_version __version__ = get_version() # Tools diff --git a/src/bindings/python/src/openvino/_ov_api.py b/src/bindings/python/src/openvino/_ov_api.py index da31fab4c95d8e..53d0fa5316498b 100644 --- a/src/bindings/python/src/openvino/_ov_api.py +++ b/src/bindings/python/src/openvino/_ov_api.py @@ -5,7 +5,9 @@ from types import TracebackType from typing import Any, Iterable, Union, Optional, Dict, Type from pathlib import Path +import warnings +import numpy as np from openvino._pyopenvino import Model as ModelBase from openvino._pyopenvino import Core as CoreBase @@ -14,7 +16,7 @@ from openvino._pyopenvino import Tensor from openvino._pyopenvino import Node -from openvino.utils.data_helpers import ( +from openvino.runtime.utils.data_helpers import ( OVDict, _InferRequestWrapper, _data_dispatch, diff --git a/src/bindings/python/src/openvino/frontend/frontend.py b/src/bindings/python/src/openvino/frontend/frontend.py index 6a16d5a573b7d7..4d549d24b4ef7c 100644 --- a/src/bindings/python/src/openvino/frontend/frontend.py +++ b/src/bindings/python/src/openvino/frontend/frontend.py @@ -7,7 +7,7 @@ from openvino._pyopenvino import FrontEnd as FrontEndBase from openvino._pyopenvino import FrontEndManager as FrontEndManagerBase from openvino._pyopenvino import InputModel -from openvino import Model +from openvino.runtime import Model class FrontEnd(FrontEndBase): diff --git a/src/bindings/python/src/openvino/frontend/jax/jaxpr_decoder.py b/src/bindings/python/src/openvino/frontend/jax/jaxpr_decoder.py index 9072598f824939..914f6b2e2ee548 100644 --- a/src/bindings/python/src/openvino/frontend/jax/jaxpr_decoder.py +++ b/src/bindings/python/src/openvino/frontend/jax/jaxpr_decoder.py @@ -6,7 +6,7 @@ import jax.core from openvino.frontend.jax.py_jax_frontend import _FrontEndJaxDecoder as Decoder -from openvino import PartialShape, Type as OVType, OVAny +from openvino.runtime import PartialShape, Type as OVType, OVAny from openvino.frontend.jax.utils import jax_array_to_ov_const, get_ov_type_for_value, \ ivalue_to_constant, param_to_constants diff --git a/src/bindings/python/src/openvino/frontend/jax/utils.py b/src/bindings/python/src/openvino/frontend/jax/utils.py index 659677b11d5af8..4535265d6de082 100644 --- a/src/bindings/python/src/openvino/frontend/jax/utils.py +++ b/src/bindings/python/src/openvino/frontend/jax/utils.py @@ -8,7 +8,7 @@ import jax.numpy as jnp import numpy as np from openvino.frontend.jax.passes import filter_element, filter_ivalue, filter_param -from openvino import op, Type as OVType, Shape, OVAny +from openvino.runtime import op, Type as OVType, Shape, OVAny numpy_to_ov_type_map = { np.float32: OVType.f32, diff --git a/src/bindings/python/src/openvino/frontend/pytorch/fx_decoder.py b/src/bindings/python/src/openvino/frontend/pytorch/fx_decoder.py index 81a2764ee1188d..c448571f1ac17a 100644 --- a/src/bindings/python/src/openvino/frontend/pytorch/fx_decoder.py +++ b/src/bindings/python/src/openvino/frontend/pytorch/fx_decoder.py @@ -10,7 +10,7 @@ from openvino.frontend.pytorch.py_pytorch_frontend import _FrontEndPytorchDecoder as Decoder from openvino.frontend.pytorch.py_pytorch_frontend import _Type as DecoderType -from openvino import PartialShape, Type as OVType, OVAny, Shape +from openvino.runtime import PartialShape, Type as OVType, OVAny, Shape from openvino.frontend.pytorch.utils import make_constant, fetch_attr, pt_to_ov_type_map, torch_tensor_to_ov_const logger = logging.getLogger(__name__) diff --git a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend.py b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend.py index a9a65781dcb254..9f2ef019769875 100644 --- a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend.py +++ b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend.py @@ -18,7 +18,7 @@ from torch._decomp import decomposition_table, get_decompositions from openvino.frontend import FrontEndManager -from openvino import Core, Type, PartialShape +from openvino.runtime import Core, Type, PartialShape from openvino.frontend.pytorch.ts_decoder import TorchScriptPythonDecoder from openvino.frontend.pytorch.torchdynamo import decompositions from openvino.frontend.pytorch.torchdynamo.decompositions import get_aot_decomposition_list, get_inf_decomposition_list @@ -27,7 +27,7 @@ from openvino.frontend.pytorch.torchdynamo.compile import cached_model_name, openvino_compile_cached_model from openvino.frontend.pytorch.torchdynamo.backend_utils import _get_cache_dir, _get_device, _get_model_caching, _get_decompositions, _get_aot_autograd -from openvino import Core, Type, PartialShape +from openvino.runtime import Core, Type, PartialShape logger = logging.getLogger(__name__) logger.setLevel(logging.WARNING) diff --git a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend_utils.py b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend_utils.py index c9a772b3feac42..47b3b82806b18b 100644 --- a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend_utils.py +++ b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend_utils.py @@ -5,7 +5,7 @@ # mypy: ignore-errors from typing import Optional, Any -from openvino import Core +from openvino.runtime import Core def _get_device(options) -> Optional[Any]: diff --git a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/compile.py b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/compile.py index ca8d5478e76c15..fa446893a05d07 100644 --- a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/compile.py +++ b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/compile.py @@ -14,7 +14,7 @@ from openvino.frontend import FrontEndManager from openvino.frontend.pytorch.fx_decoder import TorchFXPythonDecoder -from openvino import Core, Type, PartialShape, serialize +from openvino.runtime import Core, Type, PartialShape, serialize from openvino.frontend.pytorch.torchdynamo.backend_utils import _get_cache_dir, _get_device, _get_config, _is_cache_dir_in_config from typing import Callable, Optional diff --git a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/execute.py b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/execute.py index 7527ad7acb37a4..4f41f7b5a6a9de 100644 --- a/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/execute.py +++ b/src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/execute.py @@ -20,7 +20,7 @@ from openvino.frontend.pytorch.fx_decoder import TorchFXPythonDecoder from openvino.frontend.pytorch.torchdynamo.partition import Partitioner from openvino.frontend.pytorch.torchdynamo.compile import openvino_compile -from openvino import Core, Type, PartialShape +from openvino.runtime import Core, Type, PartialShape from openvino.frontend.pytorch.torchdynamo.backend_utils import _get_cache_dir, _get_device, _get_aot_autograd from typing import Callable, Optional, Any diff --git a/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py b/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py index 7bb8073167a654..6d8fdb1658793e 100644 --- a/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py +++ b/src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py @@ -6,7 +6,7 @@ from openvino.frontend.pytorch.py_pytorch_frontend import _FrontEndPytorchDecoder as Decoder from openvino.frontend.pytorch.py_pytorch_frontend import _Type as DecoderType -from openvino import op, PartialShape, Type as OVType, OVAny +from openvino.runtime import op, PartialShape, Type as OVType, OVAny from openvino.frontend.pytorch.utils import ( ivalue_to_constant, get_value_from_getattr, @@ -15,7 +15,7 @@ convert_quantized_tensor, graph_has_ops, ) -from openvino import opset11 as ops +from openvino.runtime import opset11 as ops from openvino.frontend.pytorch import quantized, patch_model from openvino.frontend.pytorch.module_extension import ModuleExtension diff --git a/src/bindings/python/src/openvino/frontend/pytorch/utils.py b/src/bindings/python/src/openvino/frontend/pytorch/utils.py index 9ba36707037c9e..826d766505fa79 100644 --- a/src/bindings/python/src/openvino/frontend/pytorch/utils.py +++ b/src/bindings/python/src/openvino/frontend/pytorch/utils.py @@ -7,8 +7,8 @@ import torch import numpy as np -from openvino import op, Type as OVType, Shape, Tensor -from openvino import opset11 as ops +from openvino.runtime import op, Type as OVType, Shape, Tensor +from openvino.runtime import opset11 as ops def make_constant(*args, **kwargs): diff --git a/src/bindings/python/src/openvino/frontend/tensorflow/node_decoder.py b/src/bindings/python/src/openvino/frontend/tensorflow/node_decoder.py index d15262cbc30366..fcedd7a74c2b51 100644 --- a/src/bindings/python/src/openvino/frontend/tensorflow/node_decoder.py +++ b/src/bindings/python/src/openvino/frontend/tensorflow/node_decoder.py @@ -7,7 +7,7 @@ import numpy as np import tensorflow as tf from openvino.frontend.tensorflow.py_tensorflow_frontend import _FrontEndDecoderBase as DecoderBase -from openvino import PartialShape, Type, OVAny, Tensor +from openvino.runtime import PartialShape, Type, OVAny, Tensor def tf_type_to_ov_type(tf_type_int): diff --git a/src/bindings/python/src/openvino/frontend/tensorflow/utils.py b/src/bindings/python/src/openvino/frontend/tensorflow/utils.py index 7de5dc950be53e..74c0dfff92297e 100644 --- a/src/bindings/python/src/openvino/frontend/tensorflow/utils.py +++ b/src/bindings/python/src/openvino/frontend/tensorflow/utils.py @@ -8,7 +8,7 @@ import logging as log import numpy as np import sys -from openvino import PartialShape, Dimension, Type +from openvino.runtime import PartialShape, Dimension, Type from packaging.version import parse, Version from typing import List, Dict, Union diff --git a/src/bindings/python/src/openvino/helpers/packing.py b/src/bindings/python/src/openvino/helpers/packing.py index d0956e09fc6261..796af87402f3a6 100644 --- a/src/bindings/python/src/openvino/helpers/packing.py +++ b/src/bindings/python/src/openvino/helpers/packing.py @@ -5,7 +5,7 @@ import numpy as np from typing import Union -from openvino import Type, Shape +from openvino.runtime import Type, Shape def pack_data(array: np.ndarray, type: Type) -> np.ndarray: diff --git a/src/bindings/python/src/openvino/opset1/ops.py b/src/bindings/python/src/openvino/opset1/ops.py index e264aea304fb1f..edca6c62a0b246 100644 --- a/src/bindings/python/src/openvino/opset1/ops.py +++ b/src/bindings/python/src/openvino/opset1/ops.py @@ -8,17 +8,17 @@ import numpy as np from functools import partial -from openvino import Node, PartialShape, Type +from openvino.runtime import Node, PartialShape, Type from openvino.op import Constant, Parameter, tensor_iterator -from openvino.utils.node_factory import _get_node_factory -from openvino.utils.decorators import binary_op, nameable_op, unary_op -from openvino.utils.input_validation import ( +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op +from openvino.runtime.utils.input_validation import ( check_valid_attributes, is_non_negative_value, is_positive_value, ) -from openvino.utils.node_factory import NodeFactory -from openvino.utils.types import ( +from openvino.runtime.utils.node_factory import NodeFactory +from openvino.runtime.utils.types import ( NodeInput, NumericData, NumericType, diff --git a/src/bindings/python/src/openvino/opset10/ops.py b/src/bindings/python/src/openvino/opset10/ops.py index d0bc3cbf1cba4a..c7b75777484a59 100644 --- a/src/bindings/python/src/openvino/opset10/ops.py +++ b/src/bindings/python/src/openvino/opset10/ops.py @@ -6,10 +6,10 @@ from functools import partial from typing import List, Optional -from openvino import Node -from openvino.utils.node_factory import _get_node_factory -from openvino.utils.decorators import nameable_op -from openvino.utils.types import ( +from openvino.runtime import Node +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import nameable_op +from openvino.runtime.utils.types import ( NodeInput, as_nodes, as_node, diff --git a/src/bindings/python/src/openvino/opset11/ops.py b/src/bindings/python/src/openvino/opset11/ops.py index 95767b4800db1c..575c99501d2d6c 100644 --- a/src/bindings/python/src/openvino/opset11/ops.py +++ b/src/bindings/python/src/openvino/opset11/ops.py @@ -6,10 +6,10 @@ from functools import partial from typing import List, Optional -from openvino import Node -from openvino.utils.node_factory import _get_node_factory -from openvino.utils.decorators import nameable_op -from openvino.utils.types import ( +from openvino.runtime import Node +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import nameable_op +from openvino.runtime.utils.types import ( NodeInput, as_nodes, ) diff --git a/src/bindings/python/src/openvino/opset12/ops.py b/src/bindings/python/src/openvino/opset12/ops.py index 4b354b1fcff973..928bf4f71a9773 100644 --- a/src/bindings/python/src/openvino/opset12/ops.py +++ b/src/bindings/python/src/openvino/opset12/ops.py @@ -6,10 +6,10 @@ from functools import partial from typing import Optional -from openvino import Node -from openvino.utils.node_factory import _get_node_factory -from openvino.utils.decorators import nameable_op -from openvino.utils.types import ( +from openvino.runtime import Node +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import nameable_op +from openvino.runtime.utils.types import ( NodeInput, as_nodes, as_node, diff --git a/src/bindings/python/src/openvino/opset13/ops.py b/src/bindings/python/src/openvino/opset13/ops.py index 5c6863740120f8..12f0d06b1a28e6 100644 --- a/src/bindings/python/src/openvino/opset13/ops.py +++ b/src/bindings/python/src/openvino/opset13/ops.py @@ -11,12 +11,12 @@ log = logging.getLogger(__name__) -from openvino import Node, Shape, Type, Output, Tensor +from openvino.runtime import Node, Shape, Type, Output, Tensor from openvino.op import Constant, Result from openvino.opset1 import convert_like -from openvino.utils.node_factory import _get_node_factory -from openvino.utils.decorators import binary_op, nameable_op, unary_op, overloading -from openvino.utils.types import ( +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op, overloading +from openvino.runtime.utils.types import ( NumericData, NodeInput, NumericType, diff --git a/src/bindings/python/src/openvino/opset14/ops.py b/src/bindings/python/src/openvino/opset14/ops.py index 59e1bfd3e89c6f..fa872d24eb7f1a 100644 --- a/src/bindings/python/src/openvino/opset14/ops.py +++ b/src/bindings/python/src/openvino/opset14/ops.py @@ -7,11 +7,11 @@ from typing import Union, Optional, List -from openvino import Node, Type -from openvino.utils.node_factory import _get_node_factory -from openvino.utils.types import TensorShape -from openvino.utils.decorators import nameable_op -from openvino.utils.types import NodeInput, as_node, as_nodes +from openvino.runtime import Node, Type +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.types import TensorShape +from openvino.runtime.utils.decorators import nameable_op +from openvino.runtime.utils.types import NodeInput, as_node, as_nodes _get_node_factory_opset14 = partial(_get_node_factory, "opset14") diff --git a/src/bindings/python/src/openvino/opset15/ops.py b/src/bindings/python/src/openvino/opset15/ops.py index 97d4419fc4834b..8e6b8bd46d5f7c 100644 --- a/src/bindings/python/src/openvino/opset15/ops.py +++ b/src/bindings/python/src/openvino/opset15/ops.py @@ -7,12 +7,12 @@ from typing import List, Literal, Optional import numpy as np -from openvino import Node, Type +from openvino.runtime import Node, Type from openvino.opset1 import convert_like from openvino.opset14 import constant -from openvino.utils.node_factory import _get_node_factory -from openvino.utils.decorators import binary_op, nameable_op -from openvino.utils.types import NodeInput, as_nodes +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import binary_op, nameable_op +from openvino.runtime.utils.types import NodeInput, as_nodes _get_node_factory_opset15 = partial(_get_node_factory, "opset15") diff --git a/src/bindings/python/src/openvino/opset16/ops.py b/src/bindings/python/src/openvino/opset16/ops.py index e5ebdc7a2a11d6..60656f6d993b6a 100644 --- a/src/bindings/python/src/openvino/opset16/ops.py +++ b/src/bindings/python/src/openvino/opset16/ops.py @@ -6,10 +6,10 @@ from functools import partial from typing import Optional -from openvino import Node -from openvino.utils.decorators import nameable_op -from openvino.utils.node_factory import _get_node_factory -from openvino.utils.types import NodeInput, as_nodes +from openvino.runtime import Node +from openvino.runtime.utils.decorators import nameable_op +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.types import NodeInput, as_nodes _get_node_factory_opset16 = partial(_get_node_factory, "opset16") diff --git a/src/bindings/python/src/openvino/opset2/ops.py b/src/bindings/python/src/openvino/opset2/ops.py index f76f608fe9a5c7..45b33f5bc0288b 100644 --- a/src/bindings/python/src/openvino/opset2/ops.py +++ b/src/bindings/python/src/openvino/opset2/ops.py @@ -9,17 +9,18 @@ from functools import partial import warnings -from openvino import Node, Shape +from openvino.runtime import Node, Shape from openvino.op import Constant, Parameter -from openvino.utils.decorators import binary_op, nameable_op, unary_op -from openvino.utils.input_validation import ( +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op +from openvino.runtime.utils.input_validation import ( assert_list_of_ints, check_valid_attributes, is_non_negative_value, is_positive_value, ) -from openvino.utils.node_factory import NodeFactory, _get_node_factory -from openvino.utils.types import ( +from openvino.runtime.utils.node_factory import NodeFactory +from openvino.runtime.utils.types import ( NodeInput, NumericData, NumericType, diff --git a/src/bindings/python/src/openvino/opset3/ops.py b/src/bindings/python/src/openvino/opset3/ops.py index 1c2c7e309fe919..989f5819acb685 100644 --- a/src/bindings/python/src/openvino/opset3/ops.py +++ b/src/bindings/python/src/openvino/opset3/ops.py @@ -8,17 +8,18 @@ import numpy as np from functools import partial -from openvino import Node, Shape +from openvino.runtime import Node, Shape from openvino.op import Constant, Parameter -from openvino.utils.decorators import binary_op, nameable_op, unary_op -from openvino.utils.input_validation import ( +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op +from openvino.runtime.utils.input_validation import ( assert_list_of_ints, check_valid_attributes, is_non_negative_value, is_positive_value, ) -from openvino.utils.node_factory import NodeFactory, _get_node_factory -from openvino.utils.types import ( +from openvino.runtime.utils.node_factory import NodeFactory +from openvino.runtime.utils.types import ( NodeInput, NumericData, NumericType, diff --git a/src/bindings/python/src/openvino/opset4/ops.py b/src/bindings/python/src/openvino/opset4/ops.py index e6f3a3a1550937..4f6ba016852b02 100644 --- a/src/bindings/python/src/openvino/opset4/ops.py +++ b/src/bindings/python/src/openvino/opset4/ops.py @@ -8,17 +8,18 @@ import numpy as np from functools import partial -from openvino import Node, Shape +from openvino.runtime import Node, Shape from openvino.op import Constant, Parameter -from openvino.utils.decorators import binary_op, nameable_op, unary_op -from openvino.utils.input_validation import ( +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op +from openvino.runtime.utils.input_validation import ( assert_list_of_ints, check_valid_attributes, is_non_negative_value, is_positive_value, ) -from openvino.utils.node_factory import NodeFactory, _get_node_factory -from openvino.utils.types import ( +from openvino.runtime.utils.node_factory import NodeFactory +from openvino.runtime.utils.types import ( NodeInput, NumericData, NumericType, diff --git a/src/bindings/python/src/openvino/opset5/ops.py b/src/bindings/python/src/openvino/opset5/ops.py index 9217830752b1d8..20057b78c7c31d 100644 --- a/src/bindings/python/src/openvino/opset5/ops.py +++ b/src/bindings/python/src/openvino/opset5/ops.py @@ -8,17 +8,18 @@ import numpy as np from functools import partial -from openvino import Node, Shape +from openvino.runtime import Node, Shape from openvino.op import Constant, Parameter, loop -from openvino.utils.decorators import binary_op, nameable_op, unary_op -from openvino.utils.input_validation import ( +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op +from openvino.runtime.utils.input_validation import ( assert_list_of_ints, check_valid_attributes, is_non_negative_value, is_positive_value, ) -from openvino.utils.node_factory import NodeFactory, _get_node_factory -from openvino.utils.types import ( +from openvino.runtime.utils.node_factory import NodeFactory +from openvino.runtime.utils.types import ( NodeInput, NumericData, NumericType, diff --git a/src/bindings/python/src/openvino/opset6/ops.py b/src/bindings/python/src/openvino/opset6/ops.py index 340d0405b4ba23..8020715f20dea3 100644 --- a/src/bindings/python/src/openvino/opset6/ops.py +++ b/src/bindings/python/src/openvino/opset6/ops.py @@ -9,13 +9,13 @@ from functools import partial, singledispatch -from openvino import Node, Type, PartialShape, Output, Shape +from openvino.runtime import Node, Type, PartialShape, Output, Shape from openvino.op import assign, Constant, Parameter from openvino.op import read_value as _read_value from openvino.op.util import VariableInfo, Variable -from openvino.utils.node_factory import _get_node_factory -from openvino.utils.decorators import nameable_op, overloading -from openvino.utils.types import ( +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import nameable_op, overloading +from openvino.runtime.utils.types import ( NodeInput, NumericType, TensorShape, diff --git a/src/bindings/python/src/openvino/opset7/ops.py b/src/bindings/python/src/openvino/opset7/ops.py index e33d266debedf1..59e09b64888eb1 100644 --- a/src/bindings/python/src/openvino/opset7/ops.py +++ b/src/bindings/python/src/openvino/opset7/ops.py @@ -7,17 +7,18 @@ from typing import Callable, Iterable, List, Optional, Set, Union import numpy as np -from openvino import Node, Shape +from openvino.runtime import Node, Shape from openvino.op import Constant, Parameter -from openvino.utils.decorators import binary_op, nameable_op, unary_op -from openvino.utils.input_validation import ( +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op +from openvino.runtime.utils.input_validation import ( assert_list_of_ints, check_valid_attributes, is_non_negative_value, is_positive_value, ) -from openvino.utils.node_factory import NodeFactory, _get_node_factory -from openvino.utils.types import ( +from openvino.runtime.utils.node_factory import NodeFactory +from openvino.runtime.utils.types import ( NodeInput, NumericData, NumericType, diff --git a/src/bindings/python/src/openvino/opset8/ops.py b/src/bindings/python/src/openvino/opset8/ops.py index a9a868e7b541d8..6995d55a28a776 100644 --- a/src/bindings/python/src/openvino/opset8/ops.py +++ b/src/bindings/python/src/openvino/opset8/ops.py @@ -9,15 +9,15 @@ import numpy as np from openvino.exceptions import UserInputError from openvino.op import Constant, Parameter, if_op -from openvino import Node -from openvino.utils.node_factory import _get_node_factory -from openvino.utils.decorators import nameable_op -from openvino.utils.input_validation import ( +from openvino.runtime import Node +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import nameable_op +from openvino.runtime.utils.input_validation import ( check_valid_attributes, is_non_negative_value, is_positive_value, ) -from openvino.utils.types import ( +from openvino.runtime.utils.types import ( NodeInput, TensorShape, as_node, diff --git a/src/bindings/python/src/openvino/opset9/ops.py b/src/bindings/python/src/openvino/opset9/ops.py index e2264845e058dc..a6d45cfd0be2cc 100644 --- a/src/bindings/python/src/openvino/opset9/ops.py +++ b/src/bindings/python/src/openvino/opset9/ops.py @@ -7,10 +7,10 @@ from typing import Optional import numpy as np -from openvino import Node -from openvino.utils.node_factory import _get_node_factory -from openvino.utils.decorators import nameable_op -from openvino.utils.types import ( +from openvino.runtime import Node +from openvino.runtime.opset_utils import _get_node_factory +from openvino.runtime.utils.decorators import nameable_op +from openvino.runtime.utils.types import ( NodeInput, as_nodes, as_node, diff --git a/src/bindings/python/src/openvino/preprocess/torchvision/preprocess_converter.py b/src/bindings/python/src/openvino/preprocess/torchvision/preprocess_converter.py index 717e945217468c..c14635cc118208 100644 --- a/src/bindings/python/src/openvino/preprocess/torchvision/preprocess_converter.py +++ b/src/bindings/python/src/openvino/preprocess/torchvision/preprocess_converter.py @@ -5,7 +5,7 @@ from typing import Callable, Any, Union import logging -import openvino as ov +import openvino.runtime as ov class PreprocessConverter(): diff --git a/src/bindings/python/src/openvino/preprocess/torchvision/torchvision_preprocessing.py b/src/bindings/python/src/openvino/preprocess/torchvision/torchvision_preprocessing.py index 5dad42b47da44a..f8b51afd546f57 100644 --- a/src/bindings/python/src/openvino/preprocess/torchvision/torchvision_preprocessing.py +++ b/src/bindings/python/src/openvino/preprocess/torchvision/torchvision_preprocessing.py @@ -20,10 +20,10 @@ import torchvision.transforms as transforms from torchvision.transforms import InterpolationMode -import openvino as ov -import openvino.opset11 as ops -from openvino import Layout, Type -from openvino.utils.decorators import custom_preprocess_function +import openvino.runtime as ov +import openvino.runtime.opset11 as ops +from openvino.runtime import Layout, Type +from openvino.runtime.utils.decorators import custom_preprocess_function from openvino.preprocess import PrePostProcessor, ResizeAlgorithm, ColorFormat diff --git a/src/bindings/python/src/openvino/runtime/opset_utils.py b/src/bindings/python/src/openvino/runtime/opset_utils.py new file mode 100644 index 00000000000000..475750e71f87c5 --- /dev/null +++ b/src/bindings/python/src/openvino/runtime/opset_utils.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2018-2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +from typing import Optional +import numpy as np + +from openvino.runtime import Node +from openvino.runtime.utils.decorators import nameable_op +from openvino.runtime.utils.node_factory import NodeFactory +from openvino.runtime.utils.types import ( + as_node, + NodeInput, +) + + +def _get_node_factory(opset_version: Optional[str] = None) -> NodeFactory: + """Return NodeFactory configured to create operators from specified opset version.""" + if opset_version: + return NodeFactory(opset_version) + else: + return NodeFactory() diff --git a/src/bindings/python/src/openvino/runtime/opset_utils/__init__.py b/src/bindings/python/src/openvino/runtime/opset_utils/__init__.py deleted file mode 100644 index 6fb3e5f6f0c950..00000000000000 --- a/src/bindings/python/src/openvino/runtime/opset_utils/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - - -from openvino.utils.node_factory import _get_node_factory diff --git a/src/bindings/python/src/openvino/runtime/utils/__init__.py b/src/bindings/python/src/openvino/runtime/utils/__init__.py index 8447e93a907277..73399ccbed2598 100644 --- a/src/bindings/python/src/openvino/runtime/utils/__init__.py +++ b/src/bindings/python/src/openvino/runtime/utils/__init__.py @@ -4,4 +4,4 @@ """Generic utilities. Factor related functions out to separate files.""" -from openvino.utils import numpy_to_c, replace_node, replace_output_update_name +from openvino._pyopenvino.util import numpy_to_c, replace_node, replace_output_update_name diff --git a/src/bindings/python/src/openvino/utils/broadcasting.py b/src/bindings/python/src/openvino/runtime/utils/broadcasting.py similarity index 87% rename from src/bindings/python/src/openvino/utils/broadcasting.py rename to src/bindings/python/src/openvino/runtime/utils/broadcasting.py index 01549625e2c628..9fd13da7728e29 100644 --- a/src/bindings/python/src/openvino/utils/broadcasting.py +++ b/src/bindings/python/src/openvino/runtime/utils/broadcasting.py @@ -3,11 +3,14 @@ # SPDX-License-Identifier: Apache-2.0 import logging -from typing import Optional +from typing import List, Optional -from openvino import AxisSet -from openvino.utils.types import ( +from openvino.runtime import AxisSet, Node +from openvino.runtime.utils.types import ( + NodeInput, TensorShape, + get_dtype, + make_constant_node, ) log = logging.getLogger(__name__) diff --git a/src/bindings/python/src/openvino/runtime/utils/broadcasting/__init__.py b/src/bindings/python/src/openvino/runtime/utils/broadcasting/__init__.py deleted file mode 100644 index 3219f239f0ab44..00000000000000 --- a/src/bindings/python/src/openvino/runtime/utils/broadcasting/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -from openvino.utils.broadcasting import get_broadcast_axes diff --git a/src/bindings/python/src/openvino/runtime/utils/data_helpers/__init__.py b/src/bindings/python/src/openvino/runtime/utils/data_helpers/__init__.py index 282547dd9df79a..a46105efaaeadb 100644 --- a/src/bindings/python/src/openvino/runtime/utils/data_helpers/__init__.py +++ b/src/bindings/python/src/openvino/runtime/utils/data_helpers/__init__.py @@ -2,7 +2,7 @@ # Copyright (C) 2018-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -from openvino.utils.data_helpers.data_dispatcher import _data_dispatch -from openvino.utils.data_helpers.wrappers import tensor_from_file -from openvino.utils.data_helpers.wrappers import _InferRequestWrapper -from openvino.utils.data_helpers.wrappers import OVDict +from openvino.runtime.utils.data_helpers.data_dispatcher import _data_dispatch +from openvino.runtime.utils.data_helpers.wrappers import tensor_from_file +from openvino.runtime.utils.data_helpers.wrappers import _InferRequestWrapper +from openvino.runtime.utils.data_helpers.wrappers import OVDict diff --git a/src/bindings/python/src/openvino/utils/data_helpers/data_dispatcher.py b/src/bindings/python/src/openvino/runtime/utils/data_helpers/data_dispatcher.py similarity index 99% rename from src/bindings/python/src/openvino/utils/data_helpers/data_dispatcher.py rename to src/bindings/python/src/openvino/runtime/utils/data_helpers/data_dispatcher.py index d4db7cb07b629c..bce10c9c3774ef 100644 --- a/src/bindings/python/src/openvino/utils/data_helpers/data_dispatcher.py +++ b/src/bindings/python/src/openvino/runtime/utils/data_helpers/data_dispatcher.py @@ -8,7 +8,7 @@ import numpy as np from openvino._pyopenvino import ConstOutput, Tensor, Type, RemoteTensor -from openvino.utils.data_helpers.wrappers import _InferRequestWrapper, OVDict +from openvino.runtime.utils.data_helpers.wrappers import _InferRequestWrapper, OVDict ContainerTypes = Union[dict, list, tuple, OVDict] ScalarTypes = Union[np.number, int, float] diff --git a/src/bindings/python/src/openvino/runtime/utils/data_helpers/data_dispatcher/__init__.py b/src/bindings/python/src/openvino/runtime/utils/data_helpers/data_dispatcher/__init__.py deleted file mode 100644 index e0a2d022660dd3..00000000000000 --- a/src/bindings/python/src/openvino/runtime/utils/data_helpers/data_dispatcher/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - - -from openvino.utils.data_helpers.data_dispatcher import ContainerTypes -from openvino.utils.data_helpers.data_dispatcher import ScalarTypes -from openvino.utils.data_helpers.data_dispatcher import ValidKeys - -from openvino.utils.data_helpers.data_dispatcher import is_list_simple_type -from openvino.utils.data_helpers.data_dispatcher import get_request_tensor -from openvino.utils.data_helpers.data_dispatcher import value_to_tensor -from openvino.utils.data_helpers.data_dispatcher import to_c_style -from openvino.utils.data_helpers.data_dispatcher import normalize_arrays -from openvino.utils.data_helpers.data_dispatcher import create_shared -from openvino.utils.data_helpers.data_dispatcher import set_request_tensor -from openvino.utils.data_helpers.data_dispatcher import update_tensor -from openvino.utils.data_helpers.data_dispatcher import update_inputs -from openvino.utils.data_helpers.data_dispatcher import create_copied -from openvino.utils.data_helpers.data_dispatcher import _data_dispatch diff --git a/src/bindings/python/src/openvino/utils/data_helpers/wrappers.py b/src/bindings/python/src/openvino/runtime/utils/data_helpers/wrappers.py similarity index 100% rename from src/bindings/python/src/openvino/utils/data_helpers/wrappers.py rename to src/bindings/python/src/openvino/runtime/utils/data_helpers/wrappers.py diff --git a/src/bindings/python/src/openvino/runtime/utils/data_helpers/wrappers/__init__.py b/src/bindings/python/src/openvino/runtime/utils/data_helpers/wrappers/__init__.py deleted file mode 100644 index 22214fd24682da..00000000000000 --- a/src/bindings/python/src/openvino/runtime/utils/data_helpers/wrappers/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - - -from openvino.utils.data_helpers.wrappers import tensor_from_file -from openvino.utils.data_helpers.wrappers import _InferRequestWrapper -from openvino.utils.data_helpers.wrappers import OVDict diff --git a/src/bindings/python/src/openvino/utils/decorators.py b/src/bindings/python/src/openvino/runtime/utils/decorators.py similarity index 98% rename from src/bindings/python/src/openvino/utils/decorators.py rename to src/bindings/python/src/openvino/runtime/utils/decorators.py index 9418c359d129e8..98da1ba4389ef7 100644 --- a/src/bindings/python/src/openvino/utils/decorators.py +++ b/src/bindings/python/src/openvino/runtime/utils/decorators.py @@ -6,8 +6,8 @@ from inspect import signature from typing import Any, Callable, Dict, Optional, Union, get_origin, get_args -from openvino import Node, Output -from openvino.utils.types import NodeInput, as_node, as_nodes +from openvino.runtime import Node, Output +from openvino.runtime.utils.types import NodeInput, as_node, as_nodes def _get_name(**kwargs: Any) -> Node: diff --git a/src/bindings/python/src/openvino/runtime/utils/decorators/__init__.py b/src/bindings/python/src/openvino/runtime/utils/decorators/__init__.py deleted file mode 100644 index bb0bac112d2c5f..00000000000000 --- a/src/bindings/python/src/openvino/runtime/utils/decorators/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -from openvino.utils.decorators import _get_name -from openvino.utils.decorators import _set_node_friendly_name -from openvino.utils.decorators import nameable_op -from openvino.utils.decorators import unary_op -from openvino.utils.decorators import binary_op -from openvino.utils.decorators import custom_preprocess_function -from openvino.utils.decorators import MultiMethod -from openvino.utils.decorators import registry -from openvino.utils.decorators import overloading diff --git a/src/bindings/python/src/openvino/utils/input_validation.py b/src/bindings/python/src/openvino/runtime/utils/input_validation.py similarity index 98% rename from src/bindings/python/src/openvino/utils/input_validation.py rename to src/bindings/python/src/openvino/runtime/utils/input_validation.py index 1de08452e1da9f..e79a16c48581b1 100644 --- a/src/bindings/python/src/openvino/utils/input_validation.py +++ b/src/bindings/python/src/openvino/runtime/utils/input_validation.py @@ -9,7 +9,7 @@ import numpy as np -from openvino.exceptions import UserInputError +from openvino.runtime.exceptions import UserInputError log = logging.getLogger(__name__) diff --git a/src/bindings/python/src/openvino/runtime/utils/input_validation/__init__.py b/src/bindings/python/src/openvino/runtime/utils/input_validation/__init__.py deleted file mode 100644 index 0b49e9ea33c40d..00000000000000 --- a/src/bindings/python/src/openvino/runtime/utils/input_validation/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -from openvino.utils.input_validation import assert_list_of_ints -from openvino.utils.input_validation import _check_value -from openvino.utils.input_validation import check_valid_attribute -from openvino.utils.input_validation import check_valid_attributes -from openvino.utils.input_validation import is_positive_value -from openvino.utils.input_validation import is_non_negative_value diff --git a/src/bindings/python/src/openvino/utils/node_factory.py b/src/bindings/python/src/openvino/runtime/utils/node_factory.py similarity index 92% rename from src/bindings/python/src/openvino/utils/node_factory.py rename to src/bindings/python/src/openvino/runtime/utils/node_factory.py index e999ae6988814a..25daf739223dba 100644 --- a/src/bindings/python/src/openvino/utils/node_factory.py +++ b/src/bindings/python/src/openvino/runtime/utils/node_factory.py @@ -2,16 +2,17 @@ # Copyright (C) 2018-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 +import logging as log -from functools import singledispatchmethod +from functools import partial, singledispatchmethod from typing import Any, Dict, List, Optional, Union from pathlib import Path from openvino._pyopenvino import NodeFactory as _NodeFactory -from openvino import Node, Output, Extension +from openvino.runtime import Node, Output, Extension -from openvino.exceptions import UserInputError +from openvino.runtime.exceptions import UserInputError DEFAULT_OPSET = "opset13" @@ -124,11 +125,3 @@ def _arguments_as_outputs(arguments: List[Union[Node, Output]]) -> List[Output]: else: outputs.extend(argument.outputs()) return outputs - - -def _get_node_factory(opset_version: Optional[str] = None) -> NodeFactory: - """Return NodeFactory configured to create operators from specified opset version.""" - if opset_version: - return NodeFactory(opset_version) - else: - return NodeFactory() diff --git a/src/bindings/python/src/openvino/runtime/utils/node_factory/__init__.py b/src/bindings/python/src/openvino/runtime/utils/node_factory/__init__.py deleted file mode 100644 index 945ea8deb7863c..00000000000000 --- a/src/bindings/python/src/openvino/runtime/utils/node_factory/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -from openvino.utils.node_factory import NodeFactory diff --git a/src/bindings/python/src/openvino/utils/reduction.py b/src/bindings/python/src/openvino/runtime/utils/reduction.py similarity index 95% rename from src/bindings/python/src/openvino/utils/reduction.py rename to src/bindings/python/src/openvino/runtime/utils/reduction.py index e6be6d0ac9a104..71d0af8de7376e 100644 --- a/src/bindings/python/src/openvino/utils/reduction.py +++ b/src/bindings/python/src/openvino/runtime/utils/reduction.py @@ -4,7 +4,7 @@ from typing import Iterable, Optional -from openvino import Node +from openvino.runtime import Node def get_reduction_axes(node: Node, reduction_axes: Optional[Iterable[int]]) -> Iterable[int]: diff --git a/src/bindings/python/src/openvino/runtime/utils/reduction/__init__.py b/src/bindings/python/src/openvino/runtime/utils/reduction/__init__.py deleted file mode 100644 index a2fbff9e793dca..00000000000000 --- a/src/bindings/python/src/openvino/runtime/utils/reduction/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -from openvino.utils.reduction import get_reduction_axes diff --git a/src/bindings/python/src/openvino/utils/types.py b/src/bindings/python/src/openvino/runtime/utils/types.py similarity index 97% rename from src/bindings/python/src/openvino/utils/types.py rename to src/bindings/python/src/openvino/runtime/utils/types.py index b3543739741d94..52f1faf8e1e839 100644 --- a/src/bindings/python/src/openvino/utils/types.py +++ b/src/bindings/python/src/openvino/runtime/utils/types.py @@ -9,9 +9,9 @@ import numpy as np -from openvino.exceptions import OVTypeError -from openvino import Node, Shape, Output, Type -from openvino.op import Constant +from openvino.runtime.exceptions import OVTypeError +from openvino.runtime import Node, Shape, Output, Type +from openvino.runtime.op import Constant log = logging.getLogger(__name__) diff --git a/src/bindings/python/src/openvino/runtime/utils/types/__init__.py b/src/bindings/python/src/openvino/runtime/utils/types/__init__.py deleted file mode 100644 index 4f88d609988e8d..00000000000000 --- a/src/bindings/python/src/openvino/runtime/utils/types/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -from openvino.utils.types import TensorShape -from openvino.utils.types import NumericData -from openvino.utils.types import NumericType -from openvino.utils.types import ScalarData -from openvino.utils.types import NodeInput - -from openvino.utils.types import openvino_to_numpy_types_map -from openvino.utils.types import openvino_to_numpy_types_str_map -from openvino.utils.types import get_element_type -from openvino.utils.types import get_element_type_str -from openvino.utils.types import get_dtype -from openvino.utils.types import get_numpy_ctype -from openvino.utils.types import get_ndarray -from openvino.utils.types import get_shape -from openvino.utils.types import make_constant_node -from openvino.utils.types import as_node -from openvino.utils.types import as_nodes diff --git a/src/bindings/python/src/openvino/package_utils.py b/src/bindings/python/src/openvino/utils.py similarity index 97% rename from src/bindings/python/src/openvino/package_utils.py rename to src/bindings/python/src/openvino/utils.py index 6aa3f3ed39b556..9890ae9b3e6460 100644 --- a/src/bindings/python/src/openvino/package_utils.py +++ b/src/bindings/python/src/openvino/utils.py @@ -21,9 +21,9 @@ def _add_openvino_libs_to_search_path() -> None: if os.path.isdir(os.path.join(os.path.dirname(__file__), "libs")): # looking for the libs in the pip installation path. openvino_libs.append(os.path.join(os.path.dirname(__file__), "libs")) - elif os.path.isdir(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, "Library", "bin")): + elif os.path.isdir(os.path.join(os.path.dirname(__file__), "..", "..", "..", "Library", "bin")): # looking for the libs in the conda installation path - openvino_libs.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, "Library", "bin")) + openvino_libs.append(os.path.join(os.path.dirname(__file__), "..", "..", "..", "Library", "bin")) else: # setupvars.bat script set all libs paths to OPENVINO_LIB_PATHS environment variable. openvino_libs_installer = os.getenv("OPENVINO_LIB_PATHS") diff --git a/src/bindings/python/src/openvino/utils/__init__.py b/src/bindings/python/src/openvino/utils/__init__.py deleted file mode 100644 index 2ccc79d20cce84..00000000000000 --- a/src/bindings/python/src/openvino/utils/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -"""Generic utilities. Factor related functions out to separate files.""" - -from openvino._pyopenvino.util import numpy_to_c, replace_node, replace_output_update_name - -from openvino.package_utils import get_cmake_path -from openvino.package_utils import deprecated -from openvino.package_utils import classproperty -from openvino.package_utils import deprecatedclassproperty diff --git a/src/bindings/python/src/openvino/utils/data_helpers/__init__.py b/src/bindings/python/src/openvino/utils/data_helpers/__init__.py deleted file mode 100644 index 282547dd9df79a..00000000000000 --- a/src/bindings/python/src/openvino/utils/data_helpers/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2018-2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -from openvino.utils.data_helpers.data_dispatcher import _data_dispatch -from openvino.utils.data_helpers.wrappers import tensor_from_file -from openvino.utils.data_helpers.wrappers import _InferRequestWrapper -from openvino.utils.data_helpers.wrappers import OVDict diff --git a/tools/benchmark_tool/openvino/__init__.py b/tools/benchmark_tool/openvino/__init__.py index 7643f742e0067d..69c678909b1c9e 100644 --- a/tools/benchmark_tool/openvino/__init__.py +++ b/tools/benchmark_tool/openvino/__init__.py @@ -7,7 +7,7 @@ # Required for Windows OS platforms # Note: always top-level try: - from openvino.package_utils import _add_openvino_libs_to_search_path + from openvino.utils import _add_openvino_libs_to_search_path _add_openvino_libs_to_search_path() except ImportError: pass @@ -17,47 +17,6 @@ # # This __init__.py forces checking of runtime modules to propagate errors. # # It is not compared with init files from openvino-dev package. # # - -# Openvino pybind bindings -from openvino._pyopenvino import AxisSet -from openvino._pyopenvino import AxisVector -from openvino._pyopenvino import ConstOutput -from openvino._pyopenvino import Coordinate -from openvino._pyopenvino import CoordinateDiff -from openvino._pyopenvino import DiscreteTypeInfo -from openvino._pyopenvino import Extension -from openvino._pyopenvino import ProfilingInfo -from openvino._pyopenvino import RTMap -from openvino._pyopenvino import Version -from openvino._pyopenvino import Symbol -from openvino._pyopenvino import Dimension -from openvino._pyopenvino import Input -from openvino._pyopenvino import Output -from openvino._pyopenvino import Node -from openvino._pyopenvino import Strides -from openvino._pyopenvino import PartialShape -from openvino._pyopenvino import Shape -from openvino._pyopenvino import Layout -from openvino._pyopenvino import Type -from openvino._pyopenvino import Tensor -from openvino._pyopenvino import OVAny -from openvino._pyopenvino import get_batch -from openvino._pyopenvino import set_batch -from openvino._pyopenvino import serialize -from openvino._pyopenvino import shutdown -from openvino._pyopenvino import save_model -from openvino._pyopenvino import layout_helpers -from openvino._pyopenvino import RemoteContext -from openvino._pyopenvino import RemoteTensor -from openvino._pyopenvino import Op - -# Import public classes from _ov_api -from openvino._ov_api import Model -from openvino._ov_api import Core -from openvino._ov_api import CompiledModel -from openvino._ov_api import InferRequest -from openvino._ov_api import AsyncInferQueue - # Import all public modules from openvino import runtime as runtime from openvino import frontend as frontend @@ -67,10 +26,36 @@ from openvino import utils as utils from openvino import properties as properties +# Import most important classes and functions from openvino.runtime +from openvino._ov_api import Model +from openvino._ov_api import Core +from openvino._ov_api import CompiledModel +from openvino._ov_api import InferRequest +from openvino._ov_api import AsyncInferQueue + +from openvino.runtime import Symbol +from openvino.runtime import Dimension +from openvino.runtime import Strides +from openvino.runtime import PartialShape +from openvino.runtime import Shape +from openvino.runtime import Layout +from openvino.runtime import Type +from openvino.runtime import Tensor +from openvino.runtime import OVAny + # Helper functions for openvino module -from openvino.utils.data_helpers import tensor_from_file +from openvino.runtime.utils.data_helpers import tensor_from_file from openvino._ov_api import compile_model +from openvino.runtime import get_batch +from openvino.runtime import set_batch +from openvino.runtime import serialize +from openvino.runtime import shutdown +from openvino.runtime import save_model +from openvino.runtime import layout_helpers +from openvino._pyopenvino import RemoteContext +from openvino._pyopenvino import RemoteTensor +from openvino._pyopenvino import Op # Import opsets from openvino import opset1 @@ -95,7 +80,7 @@ from openvino._pyopenvino import VASurfaceTensor # Set version for openvino package -from openvino._pyopenvino import get_version +from openvino.runtime import get_version __version__ = get_version() # Tools diff --git a/tools/mo/openvino/__init__.py b/tools/mo/openvino/__init__.py index 7643f742e0067d..b015570964c520 100644 --- a/tools/mo/openvino/__init__.py +++ b/tools/mo/openvino/__init__.py @@ -7,96 +7,61 @@ # Required for Windows OS platforms # Note: always top-level try: - from openvino.package_utils import _add_openvino_libs_to_search_path + from openvino.utils import _add_openvino_libs_to_search_path _add_openvino_libs_to_search_path() except ImportError: pass -# # -# # OpenVINO API -# # This __init__.py forces checking of runtime modules to propagate errors. -# # It is not compared with init files from openvino-dev package. -# # - -# Openvino pybind bindings -from openvino._pyopenvino import AxisSet -from openvino._pyopenvino import AxisVector -from openvino._pyopenvino import ConstOutput -from openvino._pyopenvino import Coordinate -from openvino._pyopenvino import CoordinateDiff -from openvino._pyopenvino import DiscreteTypeInfo -from openvino._pyopenvino import Extension -from openvino._pyopenvino import ProfilingInfo -from openvino._pyopenvino import RTMap -from openvino._pyopenvino import Version -from openvino._pyopenvino import Symbol -from openvino._pyopenvino import Dimension -from openvino._pyopenvino import Input -from openvino._pyopenvino import Output -from openvino._pyopenvino import Node -from openvino._pyopenvino import Strides -from openvino._pyopenvino import PartialShape -from openvino._pyopenvino import Shape -from openvino._pyopenvino import Layout -from openvino._pyopenvino import Type -from openvino._pyopenvino import Tensor -from openvino._pyopenvino import OVAny -from openvino._pyopenvino import get_batch -from openvino._pyopenvino import set_batch -from openvino._pyopenvino import serialize -from openvino._pyopenvino import shutdown -from openvino._pyopenvino import save_model -from openvino._pyopenvino import layout_helpers -from openvino._pyopenvino import RemoteContext -from openvino._pyopenvino import RemoteTensor -from openvino._pyopenvino import Op - -# Import public classes from _ov_api -from openvino._ov_api import Model -from openvino._ov_api import Core -from openvino._ov_api import CompiledModel -from openvino._ov_api import InferRequest -from openvino._ov_api import AsyncInferQueue +# OpenVINO API +try: + # Import all public modules + from openvino import runtime as runtime + from openvino import frontend as frontend + from openvino import helpers as helpers + from openvino import preprocess as preprocess + from openvino import utils as utils + from openvino import properties as properties -# Import all public modules -from openvino import runtime as runtime -from openvino import frontend as frontend -from openvino import helpers as helpers -from openvino import experimental as experimental -from openvino import preprocess as preprocess -from openvino import utils as utils -from openvino import properties as properties + # Import most important classes and functions from openvino.runtime + from openvino.runtime import Model + from openvino.runtime import Core + from openvino.runtime import CompiledModel + from openvino.runtime import InferRequest + from openvino.runtime import AsyncInferQueue -# Helper functions for openvino module -from openvino.utils.data_helpers import tensor_from_file -from openvino._ov_api import compile_model + from openvino.runtime import Symbol + from openvino.runtime import Dimension + from openvino.runtime import Strides + from openvino.runtime import PartialShape + from openvino.runtime import Shape + from openvino.runtime import Layout + from openvino.runtime import Type + from openvino.runtime import Tensor + from openvino.runtime import OVAny + from openvino.runtime import compile_model + from openvino.runtime import get_batch + from openvino.runtime import set_batch + from openvino.runtime import serialize + from openvino.runtime import shutdown + from openvino.runtime import tensor_from_file + from openvino.runtime import save_model + from openvino.runtime import layout_helpers -# Import opsets -from openvino import opset1 -from openvino import opset2 -from openvino import opset3 -from openvino import opset4 -from openvino import opset5 -from openvino import opset6 -from openvino import opset7 -from openvino import opset8 -from openvino import opset9 -from openvino import opset10 -from openvino import opset11 -from openvino import opset12 -from openvino import opset13 -from openvino import opset14 -from openvino import opset15 -from openvino import opset16 + from openvino._pyopenvino import RemoteContext + from openvino._pyopenvino import RemoteTensor + from openvino._pyopenvino import Op -# libva related: -from openvino._pyopenvino import VAContext -from openvino._pyopenvino import VASurfaceTensor + # libva related: + from openvino._pyopenvino import VAContext + from openvino._pyopenvino import VASurfaceTensor -# Set version for openvino package -from openvino._pyopenvino import get_version -__version__ = get_version() + # Set version for openvino package + from openvino.runtime import get_version + __version__ = get_version() +except ImportError: + import warnings + warnings.warn("openvino package has problems with imports!", ImportWarning, stacklevel=2) # Tools try: diff --git a/tools/openvino_dev/src/openvino/__init__.py b/tools/openvino_dev/src/openvino/__init__.py index 7643f742e0067d..b015570964c520 100644 --- a/tools/openvino_dev/src/openvino/__init__.py +++ b/tools/openvino_dev/src/openvino/__init__.py @@ -7,96 +7,61 @@ # Required for Windows OS platforms # Note: always top-level try: - from openvino.package_utils import _add_openvino_libs_to_search_path + from openvino.utils import _add_openvino_libs_to_search_path _add_openvino_libs_to_search_path() except ImportError: pass -# # -# # OpenVINO API -# # This __init__.py forces checking of runtime modules to propagate errors. -# # It is not compared with init files from openvino-dev package. -# # - -# Openvino pybind bindings -from openvino._pyopenvino import AxisSet -from openvino._pyopenvino import AxisVector -from openvino._pyopenvino import ConstOutput -from openvino._pyopenvino import Coordinate -from openvino._pyopenvino import CoordinateDiff -from openvino._pyopenvino import DiscreteTypeInfo -from openvino._pyopenvino import Extension -from openvino._pyopenvino import ProfilingInfo -from openvino._pyopenvino import RTMap -from openvino._pyopenvino import Version -from openvino._pyopenvino import Symbol -from openvino._pyopenvino import Dimension -from openvino._pyopenvino import Input -from openvino._pyopenvino import Output -from openvino._pyopenvino import Node -from openvino._pyopenvino import Strides -from openvino._pyopenvino import PartialShape -from openvino._pyopenvino import Shape -from openvino._pyopenvino import Layout -from openvino._pyopenvino import Type -from openvino._pyopenvino import Tensor -from openvino._pyopenvino import OVAny -from openvino._pyopenvino import get_batch -from openvino._pyopenvino import set_batch -from openvino._pyopenvino import serialize -from openvino._pyopenvino import shutdown -from openvino._pyopenvino import save_model -from openvino._pyopenvino import layout_helpers -from openvino._pyopenvino import RemoteContext -from openvino._pyopenvino import RemoteTensor -from openvino._pyopenvino import Op - -# Import public classes from _ov_api -from openvino._ov_api import Model -from openvino._ov_api import Core -from openvino._ov_api import CompiledModel -from openvino._ov_api import InferRequest -from openvino._ov_api import AsyncInferQueue +# OpenVINO API +try: + # Import all public modules + from openvino import runtime as runtime + from openvino import frontend as frontend + from openvino import helpers as helpers + from openvino import preprocess as preprocess + from openvino import utils as utils + from openvino import properties as properties -# Import all public modules -from openvino import runtime as runtime -from openvino import frontend as frontend -from openvino import helpers as helpers -from openvino import experimental as experimental -from openvino import preprocess as preprocess -from openvino import utils as utils -from openvino import properties as properties + # Import most important classes and functions from openvino.runtime + from openvino.runtime import Model + from openvino.runtime import Core + from openvino.runtime import CompiledModel + from openvino.runtime import InferRequest + from openvino.runtime import AsyncInferQueue -# Helper functions for openvino module -from openvino.utils.data_helpers import tensor_from_file -from openvino._ov_api import compile_model + from openvino.runtime import Symbol + from openvino.runtime import Dimension + from openvino.runtime import Strides + from openvino.runtime import PartialShape + from openvino.runtime import Shape + from openvino.runtime import Layout + from openvino.runtime import Type + from openvino.runtime import Tensor + from openvino.runtime import OVAny + from openvino.runtime import compile_model + from openvino.runtime import get_batch + from openvino.runtime import set_batch + from openvino.runtime import serialize + from openvino.runtime import shutdown + from openvino.runtime import tensor_from_file + from openvino.runtime import save_model + from openvino.runtime import layout_helpers -# Import opsets -from openvino import opset1 -from openvino import opset2 -from openvino import opset3 -from openvino import opset4 -from openvino import opset5 -from openvino import opset6 -from openvino import opset7 -from openvino import opset8 -from openvino import opset9 -from openvino import opset10 -from openvino import opset11 -from openvino import opset12 -from openvino import opset13 -from openvino import opset14 -from openvino import opset15 -from openvino import opset16 + from openvino._pyopenvino import RemoteContext + from openvino._pyopenvino import RemoteTensor + from openvino._pyopenvino import Op -# libva related: -from openvino._pyopenvino import VAContext -from openvino._pyopenvino import VASurfaceTensor + # libva related: + from openvino._pyopenvino import VAContext + from openvino._pyopenvino import VASurfaceTensor -# Set version for openvino package -from openvino._pyopenvino import get_version -__version__ = get_version() + # Set version for openvino package + from openvino.runtime import get_version + __version__ = get_version() +except ImportError: + import warnings + warnings.warn("openvino package has problems with imports!", ImportWarning, stacklevel=2) # Tools try: diff --git a/tools/ovc/openvino/__init__.py b/tools/ovc/openvino/__init__.py index 7643f742e0067d..69c678909b1c9e 100644 --- a/tools/ovc/openvino/__init__.py +++ b/tools/ovc/openvino/__init__.py @@ -7,7 +7,7 @@ # Required for Windows OS platforms # Note: always top-level try: - from openvino.package_utils import _add_openvino_libs_to_search_path + from openvino.utils import _add_openvino_libs_to_search_path _add_openvino_libs_to_search_path() except ImportError: pass @@ -17,47 +17,6 @@ # # This __init__.py forces checking of runtime modules to propagate errors. # # It is not compared with init files from openvino-dev package. # # - -# Openvino pybind bindings -from openvino._pyopenvino import AxisSet -from openvino._pyopenvino import AxisVector -from openvino._pyopenvino import ConstOutput -from openvino._pyopenvino import Coordinate -from openvino._pyopenvino import CoordinateDiff -from openvino._pyopenvino import DiscreteTypeInfo -from openvino._pyopenvino import Extension -from openvino._pyopenvino import ProfilingInfo -from openvino._pyopenvino import RTMap -from openvino._pyopenvino import Version -from openvino._pyopenvino import Symbol -from openvino._pyopenvino import Dimension -from openvino._pyopenvino import Input -from openvino._pyopenvino import Output -from openvino._pyopenvino import Node -from openvino._pyopenvino import Strides -from openvino._pyopenvino import PartialShape -from openvino._pyopenvino import Shape -from openvino._pyopenvino import Layout -from openvino._pyopenvino import Type -from openvino._pyopenvino import Tensor -from openvino._pyopenvino import OVAny -from openvino._pyopenvino import get_batch -from openvino._pyopenvino import set_batch -from openvino._pyopenvino import serialize -from openvino._pyopenvino import shutdown -from openvino._pyopenvino import save_model -from openvino._pyopenvino import layout_helpers -from openvino._pyopenvino import RemoteContext -from openvino._pyopenvino import RemoteTensor -from openvino._pyopenvino import Op - -# Import public classes from _ov_api -from openvino._ov_api import Model -from openvino._ov_api import Core -from openvino._ov_api import CompiledModel -from openvino._ov_api import InferRequest -from openvino._ov_api import AsyncInferQueue - # Import all public modules from openvino import runtime as runtime from openvino import frontend as frontend @@ -67,10 +26,36 @@ from openvino import utils as utils from openvino import properties as properties +# Import most important classes and functions from openvino.runtime +from openvino._ov_api import Model +from openvino._ov_api import Core +from openvino._ov_api import CompiledModel +from openvino._ov_api import InferRequest +from openvino._ov_api import AsyncInferQueue + +from openvino.runtime import Symbol +from openvino.runtime import Dimension +from openvino.runtime import Strides +from openvino.runtime import PartialShape +from openvino.runtime import Shape +from openvino.runtime import Layout +from openvino.runtime import Type +from openvino.runtime import Tensor +from openvino.runtime import OVAny + # Helper functions for openvino module -from openvino.utils.data_helpers import tensor_from_file +from openvino.runtime.utils.data_helpers import tensor_from_file from openvino._ov_api import compile_model +from openvino.runtime import get_batch +from openvino.runtime import set_batch +from openvino.runtime import serialize +from openvino.runtime import shutdown +from openvino.runtime import save_model +from openvino.runtime import layout_helpers +from openvino._pyopenvino import RemoteContext +from openvino._pyopenvino import RemoteTensor +from openvino._pyopenvino import Op # Import opsets from openvino import opset1 @@ -95,7 +80,7 @@ from openvino._pyopenvino import VASurfaceTensor # Set version for openvino package -from openvino._pyopenvino import get_version +from openvino.runtime import get_version __version__ = get_version() # Tools