[Python API] move util under utils (#10923)

* [Python API] move util under utils

* fix importing

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
This commit is contained in:
Anastasia Kuporosova 2022-03-14 14:40:28 +03:00 committed by GitHub
parent 96f954c704
commit d0b4cae2f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 12 deletions

View File

@ -31,7 +31,6 @@ from openvino.pyopenvino import AxisVector
from openvino.pyopenvino import Coordinate
from openvino.pyopenvino import Layout
from openvino.pyopenvino import ConstOutput
from openvino.pyopenvino import util
from openvino.pyopenvino import layout_helpers
from openvino.pyopenvino import RTMap

View File

@ -2,3 +2,6 @@
# SPDX-License-Identifier: Apache-2.0
"""Generic utilities. Factor related functions out to separate files."""
from openvino.pyopenvino.util import numpy_to_c
from openvino.pyopenvino.util import get_constant_from_source

View File

@ -16,7 +16,7 @@ void* numpy_to_c(py::array a) {
}
void regmodule_graph_util(py::module m) {
py::module mod = m.def_submodule("util", "openvino.runtime.util");
py::module mod = m.def_submodule("util", "openvino.runtime.utils");
mod.def("numpy_to_c", &numpy_to_c);
mod.def("get_constant_from_source",
&ov::get_constant_from_source,

View File

@ -1,8 +0,0 @@
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
from openvino.pyopenvino import util
numpy_to_c = util.numpy_to_c

View File

@ -12,7 +12,7 @@ def test_get_constant_from_source_success():
input2 = ov.opset8.parameter(Shape([25]), dtype=dtype, name="input_2")
shape_of = ov.opset8.shape_of(input2, name="shape_of")
reshape = ov.opset8.reshape(input1, shape_of, special_zero=True)
folded_const = ov.util.get_constant_from_source(reshape.input(1).get_source_output())
folded_const = ov.utils.get_constant_from_source(reshape.input(1).get_source_output())
assert folded_const is not None
assert folded_const.get_vector() == [25]
@ -23,6 +23,6 @@ def test_get_constant_from_source_failed():
input1 = ov.opset8.parameter(Shape([5, 5]), dtype=dtype, name="input_1")
input2 = ov.opset8.parameter(Shape([1]), dtype=dtype, name="input_2")
reshape = ov.opset8.reshape(input1, input2, special_zero=True)
folded_const = ov.util.get_constant_from_source(reshape.input(1).get_source_output())
folded_const = ov.utils.get_constant_from_source(reshape.input(1).get_source_output())
assert folded_const is None