Skip to content

Commit

Permalink
[Py OV] Initialize op and opset*/ops.py explicitly (#28296)
Browse files Browse the repository at this point in the history
### Details:
- An [Issue](https://jira.devtools.intel.com/browse/CVS-159892) appeared
after moving `openvino.runtime.utils` ([PR28062](
#28062)). On `openvino`
import, `op` was initialized
[here](https://github.com/openvinotoolkit/openvino/blob/26e5fe9a5961502eb3086424ce68496c9a4d7a30/src/bindings/python/src/openvino/runtime/utils/types.py#L14)
alongside utils. I propose to initialize `op` explicitly in
`openvino/runtime/__init__.py` and `openvino/__init__.py`
- Initialize ops.py in `runtime/opset*/` as they are present in the
`sys.modules` for `2024.6-openvino` and some users may access operators
directly from there.

### Tickets:
 - https://jira.devtools.intel.com/browse/CVS-159892

---------

Signed-off-by: Alicja Miloszewska <[email protected]>
  • Loading branch information
almilosz authored Jan 8, 2025
1 parent f3313e6 commit 6c610e9
Show file tree
Hide file tree
Showing 21 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bindings/python/src/openvino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from openvino._pyopenvino import Op

# Import opsets
from openvino import op
from openvino import opset1
from openvino import opset2
from openvino import opset3
Expand Down
1 change: 1 addition & 0 deletions src/bindings/python/src/openvino/runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from openvino._pyopenvino import shutdown

# Import opsets
from openvino.runtime import op
from openvino.runtime import opset1
from openvino.runtime import opset2
from openvino.runtime import opset3
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/op/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
from openvino.op import tensor_iterator
from openvino.op import read_value
from openvino.op import Result

from openvino.runtime.op import util
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset1 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset10/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset10 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset11/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset11 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset12/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset12 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset13/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset13 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset14/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset14 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset15/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset15 import ops

# New operations added in Opset15
from openvino.opset15.ops import col2im
from openvino.opset15.ops import embedding_bag_offsets
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset16/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset16 import ops

# New operations added in Opset16
from openvino.opset16.ops import identity

Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset2 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset3 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset4/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset4 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset5/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset5 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset6/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset6 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset7/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset7 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset8/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset8 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/openvino/runtime/opset9/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

from openvino.runtime.opset9 import ops

from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
Expand Down
1 change: 1 addition & 0 deletions tools/benchmark_tool/openvino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from openvino._pyopenvino import Op

# Import opsets
from openvino import op
from openvino import opset1
from openvino import opset2
from openvino import opset3
Expand Down
1 change: 1 addition & 0 deletions tools/ovc/openvino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from openvino._pyopenvino import Op

# Import opsets
from openvino import op
from openvino import opset1
from openvino import opset2
from openvino import opset3
Expand Down

0 comments on commit 6c610e9

Please sign in to comment.