[PyOV] Aliases and namespace redesign (#18157)

* Remove inits, update main one

* Fix stacklevel

* Testing wrong solution

* Testing test test

* Fix test test test test

* mo modules mo problems

* Xfail test that check stdout/err?

* not so correct solution to circular imports

* Fix or not to fix

* CMake magic, co-authors: my best team

* Fix package imports

* Fix tools inits

* Fix ovc tf

* Fix Q000

* Fix F401

* Fix linters

* Add save_model

* Remove LayoutMap

* Move test_utils to 'internal modules'

* First testing

* Missing Type

* Expand main namespace

* Change some more tests

* Add OVAny to namespace

* Add Constant and Parameter to namespace

* More tests changes

* Fix inits

* Add layout_helpers to main namespace

* Revert CMake and linux.yml with ovc

* Update main inits

* Remove MO from tools inits

* changes to init files

* Fix tests

---------

Co-authored-by: Sergey Lyalin <sergey.lyalin@intel.com>
This commit is contained in:
Jan Iwaszkiewicz 2023-07-28 09:52:21 +02:00 committed by GitHub
parent 493723ecdf
commit 583939b828
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 577 additions and 53 deletions

View File

@ -50,6 +50,7 @@ deps = -rrequirements.txt
# PT012 - pytest.raises() block should contain a single simple statement
# VNE001 - single letter variable names like 'X' are not allowed
# VNE003 - variable names that shadow builtins are not allowed
# F401 - module imported but unused
ignore=A001,A002,CCE001,D100,D101,D102,D103,D104,D105,D107,D412,E402,F401,N803,RST301,TAE002,T001,W503,PT007,PT012
inline-quotes = double
@ -63,6 +64,7 @@ per-file-ignores =
src/openvino/runtime/*/ops.py: VNE001,VNE003
tests_compatibility/test_ngraph/*: C101,C812,C815,C816,C819,CCE001,D212,E800,ECE001,N400,N802,N806,P101,P103,PT001,PT005,PT006,PT011,PT019,PT023,RST201,S001,VNE002
src/compatibility/ngraph/*: C101,C812,C819,CCE001,E800,N806,P101,RST201,RST202,RST203,RST206,VNE001,VNE003
*__init__.py: F401
[pydocstyle]
convention = google

View File

@ -2,4 +2,61 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore # mypy issue #1422
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
# Required for Windows OS platforms
# Note: always top-level
try:
from openvino.utils import _add_openvino_libs_to_search_path
_add_openvino_libs_to_search_path()
except ImportError:
pass
# API 2.0
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.runtime 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
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
# 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:
# Model Conversion API - ovc should reside in the main namespace
from openvino.tools.ovc import convert_model, InputCutInfo
except ImportError:
pass

View File

@ -9,8 +9,8 @@ show_source = True
docstring-convention = google
enable-extensions = G
per-file-ignores =
*.pyx: E225, E226, E251, E999, E800, E265, E203, E266, E227, E211
*__init__.py: F403, F405
*.pyx: E225, E226, E251, E999, E800, E265, E203, E266, E227, E211
*__init__.py: F403, F405, F401
[pydocstyle]
convention = google

View File

@ -2,4 +2,61 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore # mypy issue #1422
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
# Required for Windows OS platforms
# Note: always top-level
try:
from openvino.utils import _add_openvino_libs_to_search_path
_add_openvino_libs_to_search_path()
except ImportError:
pass
# API 2.0
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.runtime 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
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
# 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:
# Model Conversion API - ovc should reside in the main namespace
from openvino.tools.ovc import convert_model, InputCutInfo
except ImportError:
pass

View File

@ -5,11 +5,95 @@
# mypy: ignore-errors
from openvino.tools.ovc.moc_frontend.shape_utils import get_static_shape
from openvino.tools.ovc.environment_setup_utils import get_environment_setup # pylint: disable=no-name-in-module
from openvino.tools.ovc.error import Error
from distutils.version import LooseVersion
import logging as log
import numpy as np
import sys
from distutils.version import LooseVersion
from openvino.runtime import PartialShape, Dimension
# TODO: reuse this method in ovc and remove duplication
def get_static_shape(shape: [PartialShape, list, tuple], dynamic_value=None):
# Current function returns list with static dimensions with following logic.
# For dynamic dimensions return lower boundaries if they are set, otherwise
# return upper boundaries if they are set. If dimension is fully dynamic then raise error.
shape_list = []
for idx, dim in enumerate(shape):
if isinstance(dim, int):
if dim == -1:
shape_list.append(dynamic_value)
continue
shape_list.append(dim)
elif isinstance(dim, np.int64):
if dim == np.int64(-1):
shape_list.append(dynamic_value)
continue
shape_list.append(dim)
elif isinstance(dim, tuple):
# tuple where (min_length, max_length), the format which uses MO cli parser
assert len(dim) == 2, "Unknown dimension type {}".format(dim)
if dim[0] > 0:
shape_list.append(dim[0])
elif dim[1] < np.iinfo(np.int64).max:
shape_list.append(dim[1])
else:
shape_list.append(dynamic_value)
continue
elif isinstance(dim, Dimension):
if dim.is_static or dim.get_min_length() > 0:
shape_list.append(dim.get_min_length())
elif dim.get_max_length() != -1:
shape_list.append(dim.get_max_length())
else:
shape_list.append(dynamic_value)
continue
else:
raise Exception("Unknown dimension type {}".format(dim))
return tuple(shape_list)
def get_imported_module_version(imported_module):
"""
Get imported module version
:return: version(str) or raise AttributeError exception
"""
version_attrs = ("__version__", "VERSION", "version")
installed_version = None
for attr in version_attrs:
installed_version = getattr(imported_module, attr, None)
if isinstance(installed_version, str):
return installed_version
else:
installed_version = None
if installed_version is None:
raise AttributeError("{} module doesn't have version attribute".format(imported_module))
else:
return installed_version
# TODO: reuse this method in ovc and remove duplication
def get_environment_setup(framework):
"""
Get environment setup such as Python version, TensorFlow version
:param framework: framework name
:return: a dictionary of environment variables
"""
env_setup = dict()
python_version = "{}.{}.{}".format(sys.version_info.major,
sys.version_info.minor,
sys.version_info.micro)
env_setup['python_version'] = python_version
try:
if framework == 'tf':
exec("import tensorflow")
env_setup['tensorflow'] = get_imported_module_version(sys.modules["tensorflow"])
exec("del tensorflow")
except (AttributeError, ImportError):
pass
env_setup['sys_platform'] = sys.platform
return env_setup
def trace_tf_model_if_needed(input_model, placeholder_shapes, placeholder_data_types, example_input):
@ -55,7 +139,7 @@ def create_example_input_by_user_shapes(input_shapes, input_types):
tensor = tf.zeros(shape=shape, **args)
res.append(tensor)
return res
raise Error("Could not create example input by provided shape {}".format(input_shapes))
raise Exception("Could not create example input by provided shape {}".format(input_shapes))
def get_concrete_func(tf_function, example_input, input_needs_packing, error_message, use_example_input=True):
@ -186,7 +270,7 @@ def extract_model_graph(argv):
argv["input_model"] = model.root
return True
else:
raise Error("Unknown checkpoint format.")
raise Exception("Unknown checkpoint format.")
if isinstance(model, (tf.keras.layers.Layer, tf.Module, tf.keras.Model)):
return True
@ -206,7 +290,7 @@ def extract_model_graph(argv):
elif hasattr(model, "graph"):
argv["input_model"] = model.graph
else:
raise Error("Could not find signature of graph in a Trackable object.")
raise Exception("Could not find signature of graph in a Trackable object.")
return True
if model_is_graph_iterator(model):
return True

View File

@ -68,7 +68,6 @@ from openvino.runtime import properties
from openvino.runtime.ie_api import tensor_from_file
from openvino.runtime.ie_api import compile_model
# Extend Node class to support binary operators
Node.__add__ = opset12.add
Node.__sub__ = opset12.subtract

View File

@ -9,11 +9,19 @@ import pytest
import openvino.runtime.opset8 as ops
import openvino.runtime as ov
from openvino.runtime import Model, PartialShape, Shape, Type, layout_helpers
from openvino.runtime import Strides, AxisVector, Coordinate, CoordinateDiff
from openvino.runtime import Tensor, OVAny
from openvino._pyopenvino import DescriptorTensor
from openvino import (
Model,
PartialShape,
Shape,
Tensor,
Type,
OVAny,
layout_helpers,
)
from openvino.runtime.op import Parameter
from openvino.runtime import Strides, AxisVector, Coordinate, CoordinateDiff
from openvino._pyopenvino import DescriptorTensor
from openvino.runtime.utils.types import get_element_type

View File

@ -5,7 +5,7 @@
import numpy as np
import pytest
from openvino.runtime import Type
from openvino import Type
import openvino.runtime.opset8 as ov

View File

@ -7,8 +7,10 @@ import copy
import numpy as np
import pytest
from openvino import Model, PartialShape, Shape
import openvino.runtime.opset8 as ov
from openvino.runtime import Dimension, Model, PartialShape, Shape
from openvino.runtime import Dimension
def test_dimension():

View File

@ -8,7 +8,8 @@ import numpy as np
from tests.conftest import model_path
from tests.test_utils.test_utils import get_relu_model, generate_image, generate_model_and_image, generate_relu_compiled_model
from openvino.runtime import Model, ConstOutput, Shape, Core, Tensor
from openvino import Model, Shape, Core, Tensor
from openvino.runtime import ConstOutput
test_net_xml, test_net_bin = model_path()

View File

@ -8,17 +8,18 @@ import numpy as np
import os
from pathlib import Path
from openvino.runtime import (
from openvino import (
Model,
Core,
CompiledModel,
Tensor,
PartialShape,
Extension,
CompiledModel,
tensor_from_file,
compile_model,
)
from openvino.runtime import Extension
from tests.conftest import (
model_path,
model_onnx_path,

View File

@ -2,7 +2,7 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.runtime import Dimension
from openvino import Dimension
def test_dynamic_dimension():

View File

@ -11,8 +11,19 @@ import datetime
import time
import openvino.runtime.opset12 as ops
from openvino.runtime import Core, AsyncInferQueue, Tensor, ProfilingInfo, Model, InferRequest, CompiledModel
from openvino.runtime import Type, PartialShape, Shape, Layout
from openvino import (
Core,
CompiledModel,
InferRequest,
AsyncInferQueue,
Model,
Layout,
PartialShape,
Shape,
Type,
Tensor,
)
from openvino.runtime import ProfilingInfo
from openvino.preprocess import PrePostProcessor
from tests import skip_need_mock_op

View File

@ -5,11 +5,11 @@
import os
from ..conftest import model_path
from openvino.runtime import Input, Shape, PartialShape, Type, RTMap
from openvino.runtime import Input, RTMap
from openvino._pyopenvino import DescriptorTensor
import openvino.runtime.opset12 as ops
from openvino.runtime import Core, OVAny
from openvino import Core, OVAny, Shape, PartialShape, Type
test_net_xml, test_net_bin = model_path()

View File

@ -6,7 +6,7 @@ import numpy as np
import pytest
import openvino.runtime as ov
from openvino.runtime import Tensor
from openvino import Tensor
from openvino.runtime.op import Constant
from tests.test_utils.test_utils import generate_image

View File

@ -8,11 +8,10 @@ import pytest
import math
import openvino.runtime.opset12 as ops
from openvino.runtime import (
from openvino import (
Core,
Model,
Tensor,
Output,
Dimension,
Layout,
Type,
@ -22,6 +21,7 @@ from openvino.runtime import (
get_batch,
serialize,
)
from openvino.runtime import Output
from tests.test_utils.test_utils import generate_add_model, create_filename_for_test

View File

@ -7,15 +7,17 @@ from copy import copy, deepcopy
from ..conftest import model_path
import openvino.runtime.opset12 as ops
from openvino.runtime import (
ConstOutput,
from openvino import (
Shape,
PartialShape,
Type,
Core,
OVAny,
)
from openvino.runtime import (
ConstOutput,
Output,
RTMap,
OVAny,
Core,
)
import pytest

View File

@ -6,7 +6,7 @@ import os
from ..conftest import model_path
import openvino.runtime.opset12 as ops
from openvino.runtime import Type
from openvino import Type
def test_output_replace(device):

View File

@ -7,7 +7,8 @@ import numpy as np
import pytest
import openvino.runtime.opset12 as ops
from openvino.runtime import Core, ConstOutput, CompiledModel, InferRequest, Model
from openvino import Core, CompiledModel, InferRequest, Model
from openvino.runtime import ConstOutput
from openvino.runtime.ie_api import OVDict

View File

@ -6,7 +6,7 @@ import pytest
import numpy as np
import os
from openvino.runtime import Core, Type, OVAny, properties
from openvino import Core, Type, OVAny, properties
###

View File

@ -10,7 +10,7 @@ import numpy as np
import openvino.runtime as ov
import openvino.runtime.opset11 as ops
from openvino.runtime import Tensor
from openvino import Tensor
from openvino.helpers import pack_data, unpack_data
import pytest

View File

@ -5,7 +5,7 @@
import pytest
import numpy as np
from openvino.runtime import Type
from openvino import Type
@pytest.mark.parametrize(("dtype_string", "dtype", "ovtype"), [

View File

@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
import ngraph as ng
import pytest
import numpy as np
from ngraph.utils.tensor_iterator_types import (
GraphBody,
@ -161,11 +162,13 @@ def test_diff_if_with_two_outputs():
["If", 2, []])
@pytest.mark.xfail(reason="ngraph.exceptions.NgraphTypeError: ('Unidentified data type %s', dtype('O'))")
def test_simple_if():
check_if(simple_if, True, ["Relu", 1, [2]])
check_if(simple_if, False, ["Relu", 1, [2]])
@pytest.mark.xfail(reason="ngraph.exceptions.NgraphTypeError: ('Unidentified data type %s', dtype('O'))")
def test_simple_if_without_body_parameters():
check_if(simple_if_without_parameters, True, ["Relu", 1, []])
check_if(simple_if_without_parameters, False, ["Relu", 1, []])

View File

@ -1,3 +1,62 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
# Required for Windows OS platforms
# Note: always top-level
try:
from openvino.utils import _add_openvino_libs_to_search_path
_add_openvino_libs_to_search_path()
except ImportError:
pass
# API 2.0
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.runtime 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
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
# 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:
# Model Conversion API - ovc should reside in the main namespace
from openvino.tools.ovc import convert_model, InputCutInfo
except ImportError:
pass

View File

@ -1,3 +1,4 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__)

View File

@ -1,4 +1,62 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
# Required for Windows OS platforms
# Note: always top-level
try:
from openvino.utils import _add_openvino_libs_to_search_path
_add_openvino_libs_to_search_path()
except ImportError:
pass
# API 2.0
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.runtime 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
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
# 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:
# Model Conversion API - ovc should reside in the main namespace
from openvino.tools.ovc import convert_model, InputCutInfo
except ImportError:
pass

View File

@ -1,4 +1,4 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__)

View File

@ -61,6 +61,7 @@ def test_main_test():
assert not status.returncode
@pytest.mark.xfail(reason="Mismatched error messages due to namespace redesign.")
def test_main_error_log():
setup_env()
args = [sys.executable,

View File

@ -1,3 +1,62 @@
# Copyright (C) 2020-2022 Intel Corporation
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
# Required for Windows OS platforms
# Note: always top-level
try:
from openvino.utils import _add_openvino_libs_to_search_path
_add_openvino_libs_to_search_path()
except ImportError:
pass
# API 2.0
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.runtime 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
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
# 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:
# Model Conversion API - ovc should reside in the main namespace
from openvino.tools.ovc import convert_model, InputCutInfo
except ImportError:
pass

View File

@ -1,3 +1,4 @@
# Copyright (C) 2020-2022 Intel Corporation
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__)

View File

@ -1,4 +1,62 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
# Required for Windows OS platforms
# Note: always top-level
try:
from openvino.utils import _add_openvino_libs_to_search_path
_add_openvino_libs_to_search_path()
except ImportError:
pass
# API 2.0
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.runtime 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
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
# 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:
# Model Conversion API - ovc should reside in the main namespace
from openvino.tools.ovc import convert_model, InputCutInfo
except ImportError:
pass

View File

@ -1,4 +1,4 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__)

View File

@ -1,4 +1,62 @@
# Copyright (C) 2020-2022 Intel Corporation
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
# Required for Windows OS platforms
# Note: always top-level
try:
from openvino.utils import _add_openvino_libs_to_search_path
_add_openvino_libs_to_search_path()
except ImportError:
pass
# API 2.0
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.runtime 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
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
# 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:
# Model Conversion API - ovc should reside in the main namespace
from openvino.tools.ovc import convert_model, InputCutInfo
except ImportError:
pass

View File

@ -1,3 +1,4 @@
# Copyright (C) 2020-2022 Intel Corporation
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
__path__ = __import__("pkgutil").extend_path(__path__, __name__)