Skip to content

Commit

Permalink
add types
Browse files Browse the repository at this point in the history
  • Loading branch information
akuporos committed Jan 10, 2025
1 parent 5a5081e commit 948d847
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/bindings/python/src/openvino/_ov_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0

from types import TracebackType
from typing import Any, Iterable, Union, Optional, Dict, Type
from typing import Any, Iterable, Union, Optional, Dict, Type, List
from pathlib import Path


Expand All @@ -12,8 +12,7 @@
from openvino._pyopenvino import CompiledModel as CompiledModelBase
from openvino._pyopenvino import AsyncInferQueue as AsyncInferQueueBase
from openvino._pyopenvino import Op as OpBase
from openvino._pyopenvino import Tensor
from openvino._pyopenvino import Node
from openvino._pyopenvino import Node, Output, Tensor

from openvino.utils.data_helpers import (
OVDict,
Expand All @@ -24,7 +23,7 @@


class Op(OpBase):
def __init__(self, py_obj, inputs=None) -> None:
def __init__(self, py_obj: "Op", inputs: List[Union[Node, Output]] = None) -> None:
super().__init__(py_obj)
self._update_type_info()
if inputs is not None:
Expand Down
6 changes: 3 additions & 3 deletions src/bindings/python/tests/test_graph/test_custom_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CustomOpWithAttribute(Op):
class_type_info = DiscreteTypeInfo("CustomOpWithAttribute", "extension")

def __init__(self, inputs=None, attrs=None):
super().__init__(self, inputs)
super().__init__(self)
if attrs is not None or inputs is not None:
self._attrs = attrs
self.set_arguments(inputs)
Expand Down Expand Up @@ -239,9 +239,9 @@ def test_op_extension(prepared_paths):

param1 = ops.parameter(Shape(input_shape), dtype=np.float32, name="data1")
param2 = ops.parameter(Shape(input_shape), dtype=np.float32, name="data2")
custom_simple = CustomSimpleOp(inputs=[param1, param2])
custom_simple = CustomSimpleOp([param1, param2])
custom_simple.set_friendly_name("test_add")
custom_with_attribute = CustomSimpleOpWithAttribute(inputs=[custom_simple], value_str="test_attribute")
custom_with_attribute = CustomSimpleOpWithAttribute([custom_simple], value_str="test_attribute")
custom_add = CustomAdd(inputs=[custom_with_attribute])
res = ops.result(custom_add, name="result")
simple_model = Model(res, [param1, param2], "SimpleModel")
Expand Down

0 comments on commit 948d847

Please sign in to comment.