Skip to content

Commit

Permalink
[Py OV] Move ie_api.py and exceptions.py files to openvino module (op…
Browse files Browse the repository at this point in the history
…envinotoolkit#28007)

### Details:
- move `runtime/ie_api.py` and rename it to `_ov_api.py` as ie_api is a
legacy name.
- add `runtime/ie_apy/__init__.py` as proxy
- update `openvino/__init__` to import from `_ov_api.py`.

- move `runtime/exceptions.py` and add proxy in `runtime`
- update `test_ovdict` to use `OVDict` defined in
`openvino.runtime.utils.data_helpers`
- update `tensor_from_file` import in `openvino/__init__.py`. This
function is located in `openvino.runtime.utils.data_helpers`

Part of `openvino.runtime` deprecation

### Tickets:
 - [CVS-129459](https://jira.devtools.intel.com/browse/CVS-129459)

---------

Signed-off-by: Alicja Miloszewska <[email protected]>
  • Loading branch information
almilosz authored Dec 13, 2024
1 parent e3606a5 commit f790885
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 23 deletions.
15 changes: 8 additions & 7 deletions src/bindings/python/src/openvino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
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
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
Expand All @@ -43,12 +43,13 @@
from openvino.runtime import Tensor
from openvino.runtime import OVAny

from openvino.runtime import compile_model
# Helper functions for openvino module
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 tensor_from_file
from openvino.runtime import save_model
from openvino.runtime import layout_helpers

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/bindings/python/src/openvino/opset8/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import List, Optional, Tuple

import numpy as np
from openvino.runtime.exceptions import UserInputError
from openvino.exceptions import UserInputError
from openvino.op import Constant, Parameter, if_op
from openvino.runtime import Node
from openvino.runtime.opset_utils import _get_node_factory
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.exceptions import OVError
from openvino.exceptions import UserInputError
from openvino.exceptions import OVTypeError
12 changes: 12 additions & 0 deletions src/bindings/python/src/openvino/runtime/ie_api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino._ov_api import Core
from openvino._ov_api import CompiledModel
from openvino._ov_api import InferRequest
from openvino._ov_api import Model
from openvino._ov_api import AsyncInferQueue

from openvino._ov_api import tensor_from_file
from openvino._ov_api import compile_model
2 changes: 1 addition & 1 deletion src/bindings/python/tests/test_runtime/test_ovdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import openvino.runtime.opset13 as ops
from openvino import Core, CompiledModel, InferRequest, Model
from openvino.runtime import ConstOutput
from openvino.runtime.ie_api import OVDict
from openvino.runtime.utils.data_helpers import OVDict


def _get_ovdict(
Expand Down
15 changes: 8 additions & 7 deletions tools/benchmark_tool/openvino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
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
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
Expand All @@ -43,12 +43,13 @@
from openvino.runtime import Tensor
from openvino.runtime import OVAny

from openvino.runtime import compile_model
# Helper functions for openvino module
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 tensor_from_file
from openvino.runtime import save_model
from openvino.runtime import layout_helpers

Expand Down
15 changes: 8 additions & 7 deletions tools/ovc/openvino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
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
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
Expand All @@ -43,12 +43,13 @@
from openvino.runtime import Tensor
from openvino.runtime import OVAny

from openvino.runtime import compile_model
# Helper functions for openvino module
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 tensor_from_file
from openvino.runtime import save_model
from openvino.runtime import layout_helpers

Expand Down

0 comments on commit f790885

Please sign in to comment.