[Python API] Move openvino.runtime.impl to openvino.runtime (#9096)

This commit is contained in:
Katarzyna Mitrus authored and GitHub committed 2021-12-09 10:40:22 +01:00
1 parent 8b90349529
commit a787fade68
69 files changed
+202 -246

No files matched your search

+3 -4
View File
@@ -52,10 +52,9 @@ packages = [
"openvino.runtime.opset7",
"openvino.runtime.opset8",
"openvino.runtime.utils",
"openvino.runtime.impl",
"openvino.runtime.impl.op",
"openvino.runtime.impl.op.util",
"openvino.runtime.impl.passes",
"openvino.runtime.op",
"openvino.runtime.op.util",
"openvino.runtime.passes",
]
@@ -28,7 +28,7 @@ extern void regclass_pyngraph_VariantWrapper(py::module m, std::string typestrin
py::class_<AnyT<VT>, ov::Any>
variant_wrapper(m, pyclass_name, py::module_local());
variant_wrapper.doc() =
"openvino.impl.Variant[" + typestring + "] wraps ov::Any with " + typestring;
"openvino.runtime.Variant[" + typestring + "] wraps ov::Any with " + typestring;
variant_wrapper.def(py::init<const VT&>());
@@ -43,12 +43,23 @@ if sys.platform == "win32":
# Openvino pybind bindings and python extended classes
from openvino.runtime.impl import Dimension
from openvino.runtime.impl import Function
from openvino.runtime.impl import Node
from openvino.runtime.impl import PartialShape
from openvino.runtime.impl import Layout
from openvino.runtime.impl import layout_helpers
from openvino.pyopenvino import Dimension
from openvino.pyopenvino import Function
from openvino.pyopenvino import Input
from openvino.pyopenvino import Output
from openvino.pyopenvino import Node
from openvino.pyopenvino import Type
from openvino.pyopenvino import PartialShape
from openvino.pyopenvino import Shape
from openvino.pyopenvino import Strides
from openvino.pyopenvino import CoordinateDiff
from openvino.pyopenvino import AxisSet
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.runtime.ie_api import Core
from openvino.runtime.ie_api import ExecutableNetwork
@@ -1,54 +0,0 @@
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Package: openvino.impl
Low level wrappers for the c++ api.
"""
# flake8: noqa
import os
import sys
if sys.platform == "win32":
# Installer, yum, pip installs openvino dlls to the different directories
# and those paths need to be visible to the openvino modules
#
# If you're using a custom installation of openvino,
# add the location of openvino dlls to your system PATH.
#
# looking for the libs in the pip installation path by default.
openvino_libs = [os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'),
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'openvino', 'libs')]
# setupvars.bat script set all libs paths to OPENVINO_LIB_PATHS environment variable.
openvino_libs_installer = os.getenv('OPENVINO_LIB_PATHS')
if openvino_libs_installer:
openvino_libs.extend(openvino_libs_installer.split(';'))
for lib in openvino_libs:
lib_path = os.path.join(os.path.dirname(__file__), lib)
if os.path.isdir(lib_path):
# On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH.
if (3, 8) <= sys.version_info:
os.add_dll_directory(os.path.abspath(lib_path))
else:
os.environ["PATH"] = os.path.abspath(lib_path) + ";" + os.environ["PATH"]
from openvino.pyopenvino import Dimension
from openvino.pyopenvino import Function
from openvino.pyopenvino import Input
from openvino.pyopenvino import Output
from openvino.pyopenvino import Node
from openvino.pyopenvino import Type
from openvino.pyopenvino import PartialShape
from openvino.pyopenvino import Shape
from openvino.pyopenvino import Strides
from openvino.pyopenvino import CoordinateDiff
from openvino.pyopenvino import AxisSet
from openvino.pyopenvino import AxisVector
from openvino.pyopenvino import Coordinate
from openvino.pyopenvino import Output
from openvino.pyopenvino import Layout
from openvino.pyopenvino import ConstOutput
from openvino.pyopenvino import util
from openvino.pyopenvino import layout_helpers
@@ -7,8 +7,8 @@ from typing import Callable, Iterable, List, Optional, Set, Union
import numpy as np
from functools import partial
from openvino.runtime.impl import Node, PartialShape, Shape
from openvino.runtime.impl.op import Constant, Parameter
from openvino.runtime import Node, PartialShape, Shape
from openvino.runtime.op import Constant, Parameter
from openvino.runtime.opset_utils import _get_node_factory
from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op
from openvino.runtime.utils.input_validation import (
@@ -7,8 +7,8 @@ from typing import Callable, Iterable, List, Optional, Set, Union
import numpy as np
from functools import partial
from openvino.runtime.impl import Node, Shape
from openvino.runtime.impl.op import Constant, Parameter
from openvino.runtime import Node, Shape
from openvino.runtime.op import Constant, Parameter
from openvino.runtime.opset_utils import _get_node_factory
from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op
from openvino.runtime.utils.input_validation import (
@@ -7,8 +7,8 @@ from typing import Callable, Iterable, List, Optional, Set, Union
import numpy as np
from functools import partial
from openvino.runtime.impl import Node, Shape
from openvino.runtime.impl.op import Constant, Parameter
from openvino.runtime import Node, Shape
from openvino.runtime.op import Constant, Parameter
from openvino.runtime.opset_utils import _get_node_factory
from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op
from openvino.runtime.utils.input_validation import (
@@ -7,8 +7,8 @@ from typing import Callable, Iterable, List, Optional, Set, Union
import numpy as np
from functools import partial
from openvino.runtime.impl import Node, Shape
from openvino.runtime.impl.op import Constant, Parameter
from openvino.runtime import Node, Shape
from openvino.runtime.op import Constant, Parameter
from openvino.runtime.opset_utils import _get_node_factory
from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op
from openvino.runtime.utils.input_validation import (
@@ -7,8 +7,8 @@ from typing import Callable, Iterable, List, Optional, Set, Union
import numpy as np
from functools import partial
from openvino.runtime.impl import Node, Shape
from openvino.runtime.impl.op import Constant, Parameter
from openvino.runtime import Node, Shape
from openvino.runtime.op import Constant, Parameter
from openvino.runtime.opset_utils import _get_node_factory
from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op
from openvino.runtime.utils.input_validation import (
@@ -7,8 +7,8 @@ from typing import Callable, Iterable, List, Optional, Set, Union
import numpy as np
from functools import partial
from openvino.runtime.impl import Node, Shape
from openvino.runtime.impl.op import Constant, Parameter
from openvino.runtime import Node, Shape
from openvino.runtime.op import Constant, Parameter
from openvino.runtime.opset_utils import _get_node_factory
from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op
from openvino.runtime.utils.input_validation import (
@@ -6,8 +6,8 @@ from functools import partial
from typing import Callable, Iterable, List, Optional, Set, Union
import numpy as np
from openvino.runtime.impl import Node, Shape
from openvino.runtime.impl.op import Constant, Parameter
from openvino.runtime import Node, Shape
from openvino.runtime.op import Constant, Parameter
from openvino.runtime.opset_utils import _get_node_factory
from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op
from openvino.runtime.utils.input_validation import (
@@ -7,7 +7,7 @@ from typing import List, Optional, Tuple
import numpy as np
from openvino.runtime.exceptions import UserInputError
from openvino.runtime.impl import Node
from openvino.runtime import Node
from openvino.runtime.opset_utils import _get_node_factory
from openvino.runtime.utils.decorators import nameable_op
from openvino.runtime.utils.input_validation import (
@@ -4,7 +4,7 @@
from typing import Optional
import numpy as np
from openvino.runtime.impl import Node
from openvino.runtime import Node
from openvino.runtime.utils.decorators import nameable_op
from openvino.runtime.utils.node_factory import NodeFactory
from openvino.runtime.utils.types import (
@@ -4,7 +4,7 @@
import logging
from typing import List
from openvino.runtime.impl import AxisSet, Node
from openvino.runtime import AxisSet, Node
from openvino.runtime.utils.types import NodeInput, TensorShape, get_dtype, make_constant_node
log = logging.getLogger(__name__)
@@ -4,7 +4,7 @@
from functools import wraps
from typing import Any, Callable
from openvino.runtime.impl import Node, Output
from openvino.runtime import Node, Output
from openvino.runtime.utils.types import NodeInput, as_node, as_nodes
@@ -8,7 +8,7 @@ from typing import Any, Dict, List, Optional, Union
from openvino.pyopenvino import NodeFactory as _NodeFactory
from openvino.runtime.impl import Node, Output
from openvino.runtime import Node, Output
from openvino.runtime.exceptions import UserInputError
@@ -3,7 +3,7 @@
from typing import Iterable, Optional
from openvino.runtime.impl import Node
from openvino.runtime import Node
def get_reduction_axes(node: Node, reduction_axes: Optional[Iterable[int]]) -> Iterable[int]:
@@ -5,8 +5,8 @@
from typing import List
from openvino.runtime.impl import Node
from openvino.runtime.impl.op import Parameter
from openvino.runtime import Node
from openvino.runtime.op import Parameter
class GraphBody(object):
@@ -9,9 +9,9 @@ from typing import List, Union
import numpy as np
from openvino.runtime.exceptions import NgraphTypeError
from openvino.runtime.impl import Node, Shape, Output
from openvino.runtime.impl import Type as NgraphType
from openvino.runtime.impl.op import Constant
from openvino.runtime import Node, Shape, Output
from openvino.runtime import Type as NgraphType
from openvino.runtime.op import Constant
log = logging.getLogger(__name__)
@@ -17,7 +17,7 @@ namespace py = pybind11;
void regclass_graph_AxisSet(py::module m) {
py::class_<ov::AxisSet, std::shared_ptr<ov::AxisSet>> axis_set(m, "AxisSet");
axis_set.doc() = "openvino.impl.AxisSet wraps ov::AxisSet";
axis_set.doc() = "openvino.runtime.AxisSet wraps ov::AxisSet";
axis_set.def(py::init<const std::initializer_list<size_t>&>(), py::arg("axes"));
axis_set.def(py::init<const std::set<size_t>&>(), py::arg("axes"));
axis_set.def(py::init<const std::vector<size_t>&>(), py::arg("axes"));
@@ -13,7 +13,7 @@ namespace py = pybind11;
void regclass_graph_AxisVector(py::module m) {
py::class_<ov::AxisVector, std::shared_ptr<ov::AxisVector>> axis_vector(m, "AxisVector");
axis_vector.doc() = "openvino.impl.AxisVector wraps ov::AxisVector";
axis_vector.doc() = "openvino.runtime.AxisVector wraps ov::AxisVector";
axis_vector.def(py::init<const std::initializer_list<size_t>&>(), py::arg("axes"));
axis_vector.def(py::init<const std::vector<size_t>&>(), py::arg("axes"));
axis_vector.def(py::init<const ov::AxisVector&>(), py::arg("axes"));
@@ -13,7 +13,7 @@ namespace py = pybind11;
void regclass_graph_Coordinate(py::module m) {
py::class_<ov::Coordinate, std::shared_ptr<ov::Coordinate>> coordinate(m, "Coordinate");
coordinate.doc() = "openvino.impl.Coordinate wraps ov::Coordinate";
coordinate.doc() = "openvino.runtime.Coordinate wraps ov::Coordinate";
coordinate.def(py::init<const std::initializer_list<size_t>&>());
coordinate.def(py::init<const ov::Shape&>());
coordinate.def(py::init<const std::vector<size_t>&>());
@@ -17,7 +17,7 @@ namespace py = pybind11;
void regclass_graph_CoordinateDiff(py::module m) {
py::class_<ov::CoordinateDiff, std::shared_ptr<ov::CoordinateDiff>> coordinate_diff(m, "CoordinateDiff");
coordinate_diff.doc() = "openvino.impl.CoordinateDiff wraps ov::CoordinateDiff";
coordinate_diff.doc() = "openvino.runtime.CoordinateDiff wraps ov::CoordinateDiff";
coordinate_diff.def(py::init<const std::initializer_list<ptrdiff_t>&>());
coordinate_diff.def(py::init<const std::vector<ptrdiff_t>&>());
coordinate_diff.def(py::init<const ov::CoordinateDiff&>());
@@ -19,7 +19,7 @@ void regclass_graph_Dimension(py::module m) {
using value_type = ov::Dimension::value_type;
py::class_<ov::Dimension, std::shared_ptr<ov::Dimension>> dim(m, "Dimension");
dim.doc() = "openvino.impl.Dimension wraps ov::Dimension";
dim.doc() = "openvino.runtime.Dimension wraps ov::Dimension";
dim.def(py::init<>());
dim.def(py::init<value_type&>(),
py::arg("dimension"),
@@ -139,7 +139,7 @@ void regclass_graph_Dimension(py::module m) {
&ov::Dimension::compatible,
py::arg("d"),
R"(
Check whether this dimension is capable of being merged
Check whether this dimension is capable of being merged
with the argument dimension.
Parameters
@@ -46,7 +46,7 @@ ov::SinkVector cast_to_sink_vector(const std::vector<std::shared_ptr<ov::Node>>&
void regclass_graph_Function(py::module m) {
py::class_<ov::Function, std::shared_ptr<ov::Function>> function(m, "Function", py::module_local());
function.doc() = "openvino.impl.Function wraps ov::Function";
function.doc() = "openvino.runtime.Function wraps ov::Function";
function.def(py::init([](const ov::ResultVector& res,
const std::vector<std::shared_ptr<ov::Node>>& nodes,
@@ -9,7 +9,7 @@ namespace py = pybind11;
void regclass_graph_Layout(py::module m) {
py::class_<ov::Layout, std::shared_ptr<ov::Layout>> layout(m, "Layout");
layout.doc() = "openvino.impl.Layout wraps ov::Layout";
layout.doc() = "openvino.runtime.Layout wraps ov::Layout";
layout.def(py::init<>());
layout.def(py::init<const std::string&>(), py::arg("layout_str"));
@@ -11,7 +11,7 @@
namespace py = pybind11;
void regmodule_graph_layout_helpers(py::module m) {
py::module mod = m.def_submodule("layout_helpers", "openvino.impl.layout_helpers");
py::module mod = m.def_submodule("layout_helpers", "openvino.runtime.layout_helpers");
mod.def("has_batch", &ov::layout::has_batch, py::arg("layout"));
mod.def("batch_idx", &ov::layout::batch_idx, py::arg("layout"));
@@ -37,7 +37,7 @@ PYBIND11_MAKE_OPAQUE(PyRTMap);
void regclass_graph_Node(py::module m) {
py::class_<ov::Node, std::shared_ptr<ov::Node>, PyNode> node(m, "Node", py::dynamic_attr());
node.doc() = "openvino.impl.Node wraps ov::Node";
node.doc() = "openvino.runtime.Node wraps ov::Node";
node.def(
"__add__",
[](const std::shared_ptr<ov::Node>& a, const std::shared_ptr<ov::Node> b) {
@@ -13,7 +13,7 @@ namespace py = pybind11;
void regclass_graph_Input(py::module m) {
py::class_<ov::Input<ov::Node>, std::shared_ptr<ov::Input<ov::Node>>> input(m, "Input", py::dynamic_attr());
input.doc() = "openvino.impl.Input wraps ov::Input<Node>";
input.doc() = "openvino.runtime.Input wraps ov::Input<Node>";
input.def("get_node",
&ov::Input<ov::Node>::get_node,
@@ -15,7 +15,7 @@ template <typename VT>
void regclass_graph_Output(py::module m, std::string typestring)
{
auto pyclass_name = py::detail::c_str((typestring + std::string("Output")));
auto docs = py::detail::c_str((std::string("openvino.impl.") + typestring + std::string("Output wraps ov::Output<") + typestring + std::string(" ov::Node >")));
auto docs = py::detail::c_str((std::string("openvino.runtime.") + typestring + std::string("Output wraps ov::Output<") + typestring + std::string(" ov::Node >")));
py::class_<ov::Output<VT>, std::shared_ptr<ov::Output<VT>>> output(m,
pyclass_name,
py::dynamic_attr());
@@ -61,7 +61,7 @@ void regclass_graph_op_Constant(py::module m) {
py::class_<ov::op::v0::Constant, std::shared_ptr<ov::op::v0::Constant>, ov::Node> constant(m,
"Constant",
py::buffer_protocol());
constant.doc() = "openvino.impl.op.Constant wraps ov::op::v0::Constant";
constant.doc() = "openvino.runtime.op.Constant wraps ov::op::v0::Constant";
constant.def(py::init<const ov::element::Type&, const ov::Shape&, const std::vector<char>&>());
constant.def(py::init<const ov::element::Type&, const ov::Shape&, const std::vector<ov::float16>&>());
constant.def(py::init<const ov::element::Type&, const ov::Shape&, const std::vector<float>&>());
@@ -17,7 +17,7 @@ namespace py = pybind11;
void regclass_graph_op_Parameter(py::module m) {
py::class_<ov::op::v0::Parameter, std::shared_ptr<ov::op::v0::Parameter>, ov::Node> parameter(m, "Parameter");
parameter.doc() = "openvino.impl.op.Parameter wraps ov::op::v0::Parameter";
parameter.doc() = "openvino.runtime.op.Parameter wraps ov::op::v0::Parameter";
parameter.def("__repr__", [](const ov::Node& self) {
std::string class_name = py::cast(self).get_type().attr("__name__").cast<std::string>();
std::string shape = py::cast(self.get_output_partial_shape(0)).attr("__str__")().cast<std::string>();
@@ -17,7 +17,7 @@ namespace py = pybind11;
void regclass_graph_op_Result(py::module m) {
py::class_<ov::op::v0::Result, std::shared_ptr<ov::op::v0::Result>, ov::Node> result(m, "Result");
result.doc() = "openvino.impl.op.Result wraps ov::op::v0::Result";
result.doc() = "openvino.runtime.op.Result wraps ov::op::v0::Result";
result.def("get_output_partial_shape", &ov::Node::get_output_partial_shape, py::arg("index"));
@@ -10,14 +10,14 @@ namespace py = pybind11;
void regclass_graph_op_util_Variable(py::module m) {
py::class_<ov::op::util::VariableInfo> variable_info(m, "VariableInfo");
variable_info.doc() = "openvino.impl.op.util.VariableInfo wraps ov::op::util::VariableInfo";
variable_info.doc() = "openvino.runtime.op.util.VariableInfo wraps ov::op::util::VariableInfo";
variable_info.def(py::init<>());
variable_info.def_readwrite("data_shape", &ov::op::util::VariableInfo::data_shape);
variable_info.def_readwrite("data_type", &ov::op::util::VariableInfo::data_type);
variable_info.def_readwrite("variable_id", &ov::op::util::VariableInfo::variable_id);
py::class_<ov::op::util::Variable, std::shared_ptr<ov::op::util::Variable>> variable(m, "Variable");
variable.doc() = "openvino.impl.op.util.Variable wraps ov::op::util::Variable";
variable.doc() = "openvino.runtime.op.util.Variable wraps ov::op::util::Variable";
variable.def(py::init([](const ov::op::util::VariableInfo& info) {
return ov::op::util::Variable{info};
}),
@@ -21,7 +21,7 @@ static const char* CAPSULE_NAME = "ngraph_partial_shape";
void regclass_graph_PartialShape(py::module m) {
py::class_<ov::PartialShape, std::shared_ptr<ov::PartialShape>> shape(m, "PartialShape");
shape.doc() = "openvino.impl.PartialShape wraps ov::PartialShape";
shape.doc() = "openvino.runtime.PartialShape wraps ov::PartialShape";
shape.def(py::init([](const std::vector<int64_t>& dimensions) {
return ov::PartialShape(std::vector<ov::Dimension>(dimensions.begin(), dimensions.end()));
@@ -46,7 +46,7 @@ void regclass_graph_PartialShape(py::module m) {
&ov::PartialShape::is_static,
R"(
True if this shape is static, else False.
A shape is considered static if it has static rank,
A shape is considered static if it has static rank,
and all dimensions of the shape are static.
)");
shape.def_property_readonly("rank",
@@ -57,7 +57,7 @@ void regclass_graph_PartialShape(py::module m) {
shape.def_property_readonly("all_non_negative",
&ov::PartialShape::all_non_negative,
R"(
True if all static dimensions of the tensor are
True if all static dimensions of the tensor are
non-negative, else False.
)");
@@ -67,7 +67,7 @@ void regclass_graph_PartialShape(py::module m) {
R"(
Check whether this shape is compatible with the argument, i.e.,
whether it is possible to merge them.
Parameters
----------
s : PartialShape
@@ -88,8 +88,8 @@ void regclass_graph_PartialShape(py::module m) {
Parameters
----------
s : PartialShape
The shape which is being compared against this shape.
The shape which is being compared against this shape.
Returns
----------
refines : bool
@@ -104,8 +104,8 @@ void regclass_graph_PartialShape(py::module m) {
Parameters
----------
s : PartialShape
The shape which is being compared against this shape.
The shape which is being compared against this shape.
Returns
----------
relaxes : bool
@@ -120,8 +120,8 @@ void regclass_graph_PartialShape(py::module m) {
Parameters
----------
s : PartialShape
The shape which is being compared against this shape.
The shape which is being compared against this shape.
Returns
----------
same_scheme : bool
@@ -65,7 +65,7 @@ public:
void regclass_graph_passes_Manager(py::module m) {
py::class_<ManagerWrapper> manager(m, "Manager");
manager.doc() = "openvino.impl.passes.Manager wraps ov::pass::Manager using ManagerWrapper";
manager.doc() = "openvino.runtime.passes.Manager wraps ov::pass::Manager using ManagerWrapper";
manager.def(py::init<>());
@@ -9,6 +9,6 @@
namespace py = pybind11;
void regmodule_graph_passes(py::module m) {
py::module m_passes = m.def_submodule("passes", "Package openvino.impl.passes wraps ov::passes");
py::module m_passes = m.def_submodule("passes", "Package openvino.runtime.passes wraps ov::passes");
regclass_graph_passes_Manager(m_passes);
}
@@ -21,7 +21,7 @@ static void regclass_graph_PreProcessSteps(py::module m) {
py::class_<ov::preprocess::PreProcessSteps, Common::ref_wrapper<ov::preprocess::PreProcessSteps>> steps(
m,
"PreProcessSteps");
steps.doc() = "openvino.impl.preprocess.PreProcessSteps wraps ov::preprocess::PreProcessSteps";
steps.doc() = "openvino.runtime.preprocess.PreProcessSteps wraps ov::preprocess::PreProcessSteps";
steps.def(
"mean",
@@ -173,7 +173,7 @@ static void regclass_graph_PostProcessSteps(py::module m) {
py::class_<ov::preprocess::PostProcessSteps, Common::ref_wrapper<ov::preprocess::PostProcessSteps>> steps(
m,
"PostProcessSteps");
steps.doc() = "openvino.impl.preprocess.PostprocessSteps wraps ov::preprocess::PostProcessSteps";
steps.doc() = "openvino.runtime.preprocess.PostprocessSteps wraps ov::preprocess::PostProcessSteps";
steps.def(
"convert_element_type",
@@ -227,7 +227,7 @@ static void regclass_graph_InputTensorInfo(py::module m) {
py::class_<ov::preprocess::InputTensorInfo, Common::ref_wrapper<ov::preprocess::InputTensorInfo>> info(
m,
"InputTensorInfo");
info.doc() = "openvino.impl.preprocess.InputTensorInfo wraps ov::preprocess::InputTensorInfo";
info.doc() = "openvino.runtime.preprocess.InputTensorInfo wraps ov::preprocess::InputTensorInfo";
info.def(
"set_element_type",
@@ -275,7 +275,7 @@ static void regclass_graph_OutputTensorInfo(py::module m) {
py::class_<ov::preprocess::OutputTensorInfo, Common::ref_wrapper<ov::preprocess::OutputTensorInfo>> info(
m,
"OutputTensorInfo");
info.doc() = "openvino.impl.preprocess.OutputTensorInfo wraps ov::preprocess::OutputTensorInfo";
info.doc() = "openvino.runtime.preprocess.OutputTensorInfo wraps ov::preprocess::OutputTensorInfo";
info.def(
"set_element_type",
@@ -302,7 +302,7 @@ static void regclass_graph_OutputTensorInfo(py::module m) {
static void regclass_graph_InputInfo(py::module m) {
py::class_<ov::preprocess::InputInfo, Common::ref_wrapper<ov::preprocess::InputInfo>> inp(m, "InputInfo");
inp.doc() = "openvino.impl.preprocess.InputInfo wraps ov::preprocess::InputInfo";
inp.doc() = "openvino.runtime.preprocess.InputInfo wraps ov::preprocess::InputInfo";
inp.def("tensor", [](ov::preprocess::InputInfo& me) {
return &me.tensor();
@@ -317,7 +317,7 @@ static void regclass_graph_InputInfo(py::module m) {
static void regclass_graph_OutputInfo(py::module m) {
py::class_<ov::preprocess::OutputInfo, Common::ref_wrapper<ov::preprocess::OutputInfo>> out(m, "OutputInfo");
out.doc() = "openvino.impl.preprocess.OutputInfo wraps ov::preprocess::OutputInfo";
out.doc() = "openvino.runtime.preprocess.OutputInfo wraps ov::preprocess::OutputInfo";
out.def("tensor", [](ov::preprocess::OutputInfo& me) {
return &me.tensor();
@@ -334,7 +334,7 @@ static void regclass_graph_OutputModelInfo(py::module m) {
py::class_<ov::preprocess::OutputModelInfo, Common::ref_wrapper<ov::preprocess::OutputModelInfo>> info(
m,
"OutputModelInfo");
info.doc() = "openvino.impl.preprocess.OutputModelInfo wraps ov::preprocess::OutputModelInfo";
info.doc() = "openvino.runtime.preprocess.OutputModelInfo wraps ov::preprocess::OutputModelInfo";
info.def("set_layout", [](ov::preprocess::OutputModelInfo& me, const ov::Layout& layout) {
return &me.set_layout(layout);
@@ -345,7 +345,7 @@ static void regclass_graph_InputModelInfo(py::module m) {
py::class_<ov::preprocess::InputModelInfo, Common::ref_wrapper<ov::preprocess::InputModelInfo>> info(
m,
"InputModelInfo");
info.doc() = "openvino.impl.preprocess.InputModelInfo wraps ov::preprocess::InputModelInfo";
info.doc() = "openvino.runtime.preprocess.InputModelInfo wraps ov::preprocess::InputModelInfo";
info.def("set_layout", [](ov::preprocess::InputModelInfo& me, const ov::Layout& layout) {
return &me.set_layout(layout);
@@ -388,7 +388,7 @@ void regclass_graph_PrePostProcessor(py::module m) {
py::class_<ov::preprocess::PrePostProcessor, std::shared_ptr<ov::preprocess::PrePostProcessor>> proc(
m,
"PrePostProcessor");
proc.doc() = "openvino.impl.preprocess.PrePostProcessor wraps ov::preprocess::PrePostProcessor";
proc.doc() = "openvino.runtime.preprocess.PrePostProcessor wraps ov::preprocess::PrePostProcessor";
proc.def(py::init<const std::shared_ptr<ov::Function>&>());
@@ -27,7 +27,7 @@ PYBIND11_MAKE_OPAQUE(PyRTMap);
void regclass_graph_PyRTMap(py::module m) {
auto py_map = py::class_<PyRTMap>(m, "PyRTMap");
py_map.doc() = "openvino.impl.PyRTMap makes bindings for std::map<std::string, "
py_map.doc() = "openvino.runtime.PyRTMap makes bindings for std::map<std::string, "
"ov::Any, which can later be used as ov::Node::RTMap";
py_map.def("__setitem__", [](PyRTMap& m, const std::string& k, const std::string v) {
@@ -18,7 +18,7 @@ namespace py = pybind11;
void regclass_graph_Shape(py::module m) {
py::class_<ov::Shape, std::shared_ptr<ov::Shape>> shape(m, "Shape");
shape.doc() = "openvino.impl.Shape wraps ov::Shape";
shape.doc() = "openvino.runtime.Shape wraps ov::Shape";
shape.def(py::init<const std::initializer_list<size_t>&>(), py::arg("axis_lengths"));
shape.def(py::init<const std::vector<size_t>&>(), py::arg("axis_lengths"));
shape.def(py::init<const ov::Shape&>(), py::arg("axis_lengths"));
@@ -17,7 +17,7 @@ namespace py = pybind11;
void regclass_graph_Strides(py::module m) {
py::class_<ov::Strides, std::shared_ptr<ov::Strides>> strides(m, "Strides");
strides.doc() = "openvino.impl.Strides wraps ov::Strides";
strides.doc() = "openvino.runtime.Strides wraps ov::Strides";
strides.def(py::init<const std::initializer_list<size_t>&>(), py::arg("axis_strides"));
strides.def(py::init<const std::vector<size_t>&>(), py::arg("axis_strides"));
strides.def(py::init<const ov::Strides&>(), py::arg("axis_strides"));
@@ -14,7 +14,7 @@ namespace py = pybind11;
void regclass_graph_Type(py::module m) {
py::class_<ov::element::Type, std::shared_ptr<ov::element::Type>> type(m, "Type");
type.doc() = "openvino.impl.Type wraps ov::element::Type";
type.doc() = "openvino.runtime.Type wraps ov::element::Type";
type.attr("boolean") = ov::element::boolean;
type.attr("f16") = ov::element::f16;
type.attr("f32") = ov::element::f32;
@@ -13,7 +13,7 @@ namespace py = pybind11;
void regclass_graph_Variant(py::module m) {
py::class_<PyAny, std::shared_ptr<PyAny>> variant(m, "Variant", py::module_local());
variant.doc() = "openvino.impl.Variant wraps ov::Any";
variant.doc() = "openvino.runtime.Variant wraps ov::Any";
variant.def(py::init<py::object>());
variant.def("__repr__", [](const PyAny& self) {
@@ -91,7 +91,7 @@ PYBIND11_MODULE(pyopenvino, m) {
#endif
regmodule_graph_op_util(m_op);
py::module m_preprocess =
m.def_submodule("preprocess", "Package openvino.impl.preprocess that wraps ov::preprocess");
m.def_submodule("preprocess", "Package openvino.runtime.preprocess that wraps ov::preprocess");
regclass_graph_PrePostProcessor(m_preprocess);
regclass_graph_Function(m);
regmodule_graph_passes(m);
+1 -1
View File
@@ -11,7 +11,7 @@ import numpy as np
from openvino.runtime import Core
from openvino.runtime.exceptions import UserInputError
from openvino.runtime.impl import Function, Node, PartialShape, Type
from openvino.runtime import Function, Node, PartialShape, Type
from openvino.runtime.utils.types import NumericData, get_shape, get_dtype
import tests
@@ -6,7 +6,7 @@ import pytest
import numpy as np
from ..conftest import model_path, read_image
from openvino.runtime.impl import Function, ConstOutput, Shape
from openvino.runtime import Function, ConstOutput, Shape
from openvino.runtime import Core, Tensor
@@ -221,7 +221,7 @@ def test_inputs_docs(device):
exec_net = core.compile_model(func, device)
inputs = exec_net.inputs
input_0 = inputs[0]
expected_string = "openvino.impl.ConstOutput wraps ov::Output<Const ov::Node >"
expected_string = "openvino.runtime.ConstOutput wraps ov::Output<Const ov::Node >"
assert input_0.__doc__ == expected_string
@@ -7,7 +7,7 @@ import pytest
import openvino.runtime.opset8 as ops
from openvino.runtime import Function, Tensor
from openvino.runtime.impl import Type, PartialShape, Shape
from openvino.runtime import Type, PartialShape, Shape
def test_test_descriptor_tensor():
@@ -4,7 +4,7 @@
import os
from ..conftest import model_path
from openvino.runtime.impl import ConstOutput, Shape, PartialShape, Type
from openvino.runtime import ConstOutput, Shape, PartialShape, Type
from openvino.runtime import Core
@@ -36,7 +36,7 @@ def test_const_output_docs(device):
func = core.read_model(model=test_net_xml, weights=test_net_bin)
exec_net = core.compile_model(func, device)
node = exec_net.input(0)
exptected_string = "openvino.impl.ConstOutput wraps ov::Output<Const ov::Node >"
exptected_string = "openvino.runtime.ConstOutput wraps ov::Output<Const ov::Node >"
assert node.__doc__ == exptected_string
@@ -10,24 +10,24 @@ import openvino.runtime as ov
@pytest.mark.parametrize("ov_type, numpy_dtype", [
(ov.impl.Type.f32, np.float32),
(ov.impl.Type.f64, np.float64),
(ov.impl.Type.f16, np.float16),
(ov.impl.Type.bf16, np.float16),
(ov.impl.Type.i8, np.int8),
(ov.impl.Type.u8, np.uint8),
(ov.impl.Type.i32, np.int32),
(ov.impl.Type.u32, np.uint32),
(ov.impl.Type.i16, np.int16),
(ov.impl.Type.u16, np.uint16),
(ov.impl.Type.i64, np.int64),
(ov.impl.Type.u64, np.uint64),
(ov.impl.Type.boolean, np.bool),
# (ov.impl.Type.u1, np.uint8),
(ov.Type.f32, np.float32),
(ov.Type.f64, np.float64),
(ov.Type.f16, np.float16),
(ov.Type.bf16, np.float16),
(ov.Type.i8, np.int8),
(ov.Type.u8, np.uint8),
(ov.Type.i32, np.int32),
(ov.Type.u32, np.uint32),
(ov.Type.i16, np.int16),
(ov.Type.u16, np.uint16),
(ov.Type.i64, np.int64),
(ov.Type.u64, np.uint64),
(ov.Type.boolean, np.bool),
# (ov.Type.u1, np.uint8),
])
def test_init_with_ngraph(ov_type, numpy_dtype):
ov_tensors = []
ov_tensors.append(Tensor(type=ov_type, shape=ov.impl.Shape([1, 3, 32, 32])))
ov_tensors.append(Tensor(type=ov_type, shape=ov.Shape([1, 3, 32, 32])))
ov_tensors.append(Tensor(type=ov_type, shape=[1, 3, 32, 32]))
assert np.all([list(ov_tensor.shape) == [1, 3, 32, 32] for ov_tensor in ov_tensors])
assert np.all(ov_tensor.element_type == ov_type for ov_tensor in ov_tensors)
@@ -36,22 +36,22 @@ def test_init_with_ngraph(ov_type, numpy_dtype):
@pytest.mark.parametrize("ov_type, numpy_dtype", [
(ov.impl.Type.f32, np.float32),
(ov.impl.Type.f64, np.float64),
(ov.impl.Type.f16, np.float16),
(ov.impl.Type.i8, np.int8),
(ov.impl.Type.u8, np.uint8),
(ov.impl.Type.i32, np.int32),
(ov.impl.Type.u32, np.uint32),
(ov.impl.Type.i16, np.int16),
(ov.impl.Type.u16, np.uint16),
(ov.impl.Type.i64, np.int64),
(ov.impl.Type.u64, np.uint64),
(ov.impl.Type.boolean, np.bool)
(ov.Type.f32, np.float32),
(ov.Type.f64, np.float64),
(ov.Type.f16, np.float16),
(ov.Type.i8, np.int8),
(ov.Type.u8, np.uint8),
(ov.Type.i32, np.int32),
(ov.Type.u32, np.uint32),
(ov.Type.i16, np.int16),
(ov.Type.u16, np.uint16),
(ov.Type.i64, np.int64),
(ov.Type.u64, np.uint64),
(ov.Type.boolean, np.bool)
])
def test_init_with_numpy_dtype(ov_type, numpy_dtype):
shape = (1, 3, 127, 127)
ov_shape = ov.impl.Shape(shape)
ov_shape = ov.Shape(shape)
ov_tensors = []
ov_tensors.append(Tensor(type=numpy_dtype, shape=shape))
ov_tensors.append(Tensor(type=np.dtype(numpy_dtype), shape=shape))
@@ -66,18 +66,18 @@ def test_init_with_numpy_dtype(ov_type, numpy_dtype):
@pytest.mark.parametrize("ov_type, numpy_dtype", [
(ov.impl.Type.f32, np.float32),
(ov.impl.Type.f64, np.float64),
(ov.impl.Type.f16, np.float16),
(ov.impl.Type.i8, np.int8),
(ov.impl.Type.u8, np.uint8),
(ov.impl.Type.i32, np.int32),
(ov.impl.Type.u32, np.uint32),
(ov.impl.Type.i16, np.int16),
(ov.impl.Type.u16, np.uint16),
(ov.impl.Type.i64, np.int64),
(ov.impl.Type.u64, np.uint64),
(ov.impl.Type.boolean, np.bool)
(ov.Type.f32, np.float32),
(ov.Type.f64, np.float64),
(ov.Type.f16, np.float16),
(ov.Type.i8, np.int8),
(ov.Type.u8, np.uint8),
(ov.Type.i32, np.int32),
(ov.Type.u32, np.uint32),
(ov.Type.i16, np.int16),
(ov.Type.u16, np.uint16),
(ov.Type.i64, np.int64),
(ov.Type.u64, np.uint64),
(ov.Type.boolean, np.bool)
])
def test_init_with_numpy_shared_memory(ov_type, numpy_dtype):
arr = read_image().astype(numpy_dtype)
@@ -96,18 +96,18 @@ def test_init_with_numpy_shared_memory(ov_type, numpy_dtype):
@pytest.mark.parametrize("ov_type, numpy_dtype", [
(ov.impl.Type.f32, np.float32),
(ov.impl.Type.f64, np.float64),
(ov.impl.Type.f16, np.float16),
(ov.impl.Type.i8, np.int8),
(ov.impl.Type.u8, np.uint8),
(ov.impl.Type.i32, np.int32),
(ov.impl.Type.u32, np.uint32),
(ov.impl.Type.i16, np.int16),
(ov.impl.Type.u16, np.uint16),
(ov.impl.Type.i64, np.int64),
(ov.impl.Type.u64, np.uint64),
(ov.impl.Type.boolean, np.bool)
(ov.Type.f32, np.float32),
(ov.Type.f64, np.float64),
(ov.Type.f16, np.float16),
(ov.Type.i8, np.int8),
(ov.Type.u8, np.uint8),
(ov.Type.i32, np.int32),
(ov.Type.u32, np.uint32),
(ov.Type.i16, np.int16),
(ov.Type.u16, np.uint16),
(ov.Type.i64, np.int64),
(ov.Type.u64, np.uint64),
(ov.Type.boolean, np.bool)
])
def test_init_with_numpy_copy_memory(ov_type, numpy_dtype):
arr = read_image().astype(numpy_dtype)
@@ -142,47 +142,47 @@ def test_init_with_roi_tensor():
@pytest.mark.parametrize("ov_type, numpy_dtype", [
(ov.impl.Type.f32, np.float32),
(ov.impl.Type.f64, np.float64),
(ov.impl.Type.f16, np.float16),
(ov.impl.Type.bf16, np.float16),
(ov.impl.Type.i8, np.int8),
(ov.impl.Type.u8, np.uint8),
(ov.impl.Type.i32, np.int32),
(ov.impl.Type.u32, np.uint32),
(ov.impl.Type.i16, np.int16),
(ov.impl.Type.u16, np.uint16),
(ov.impl.Type.i64, np.int64),
(ov.impl.Type.u64, np.uint64),
(ov.impl.Type.boolean, np.bool),
# (ov.impl.Type.u1, np.uint8),
(ov.Type.f32, np.float32),
(ov.Type.f64, np.float64),
(ov.Type.f16, np.float16),
(ov.Type.bf16, np.float16),
(ov.Type.i8, np.int8),
(ov.Type.u8, np.uint8),
(ov.Type.i32, np.int32),
(ov.Type.u32, np.uint32),
(ov.Type.i16, np.int16),
(ov.Type.u16, np.uint16),
(ov.Type.i64, np.int64),
(ov.Type.u64, np.uint64),
(ov.Type.boolean, np.bool),
# (ov.Type.u1, np.uint8),
])
def test_write_to_buffer(ov_type, numpy_dtype):
ov_tensor = Tensor(ov_type, ov.impl.Shape([1, 3, 32, 32]))
ov_tensor = Tensor(ov_type, ov.Shape([1, 3, 32, 32]))
ones_arr = np.ones([1, 3, 32, 32], numpy_dtype)
ov_tensor.data[:] = ones_arr
assert np.array_equal(ov_tensor.data, ones_arr)
@pytest.mark.parametrize("ov_type, numpy_dtype", [
(ov.impl.Type.f32, np.float32),
(ov.impl.Type.f64, np.float64),
(ov.impl.Type.f16, np.float16),
(ov.impl.Type.bf16, np.float16),
(ov.impl.Type.i8, np.int8),
(ov.impl.Type.u8, np.uint8),
(ov.impl.Type.i32, np.int32),
(ov.impl.Type.u32, np.uint32),
(ov.impl.Type.i16, np.int16),
(ov.impl.Type.u16, np.uint16),
(ov.impl.Type.i64, np.int64),
(ov.impl.Type.u64, np.uint64),
(ov.impl.Type.boolean, np.bool),
# (ov.impl.Type.u1, np.uint8),
(ov.Type.f32, np.float32),
(ov.Type.f64, np.float64),
(ov.Type.f16, np.float16),
(ov.Type.bf16, np.float16),
(ov.Type.i8, np.int8),
(ov.Type.u8, np.uint8),
(ov.Type.i32, np.int32),
(ov.Type.u32, np.uint32),
(ov.Type.i16, np.int16),
(ov.Type.u16, np.uint16),
(ov.Type.i64, np.int64),
(ov.Type.u64, np.uint64),
(ov.Type.boolean, np.bool),
# (ov.Type.u1, np.uint8),
])
def test_set_shape(ov_type, numpy_dtype):
shape = ov.impl.Shape([1, 3, 32, 32])
ref_shape = ov.impl.Shape([1, 3, 48, 48])
shape = ov.Shape([1, 3, 32, 32])
ref_shape = ov.Shape([1, 3, 48, 48])
ref_shape_np = [1, 3, 28, 28]
ov_tensor = Tensor(ov_type, shape)
ov_tensor.shape = ref_shape
@@ -12,10 +12,10 @@ import openvino.runtime as ov
from openvino.pyopenvino import Variant
from openvino.runtime.exceptions import UserInputError
from openvino.runtime.impl import Function, PartialShape, Shape, Type, layout_helpers
from openvino.runtime import Function, PartialShape, Shape, Type, layout_helpers
from openvino.runtime import Tensor
from openvino.pyopenvino import DescriptorTensor
from openvino.runtime.impl.op import Parameter
from openvino.runtime.op import Parameter
from tests.runtime import get_runtime
from tests.test_ngraph.util import run_op_node
@@ -4,7 +4,7 @@
import numpy as np
import openvino.runtime.opset8 as ov
from openvino.runtime.impl import Dimension, Function, PartialShape, Shape
from openvino.runtime import Dimension, Function, PartialShape, Shape
def test_dimension():
@@ -9,7 +9,7 @@ from openvino.runtime.exceptions import UserInputError
import openvino.runtime.opset8 as ov
import openvino.runtime.opset1 as ov_opset1
import openvino.runtime.opset5 as ov_opset5
from openvino.runtime.impl import Type
from openvino.runtime import Type
np_types = [np.float32, np.int32]
integral_np_types = [
@@ -4,7 +4,7 @@
import numpy as np
import openvino.runtime.opset8 as ov
from openvino.runtime.impl import Type
from openvino.runtime import Type
def test_ctc_loss_props():
@@ -4,7 +4,7 @@
import numpy as np
import openvino.runtime.opset8 as ov
from openvino.runtime.impl import Type, Shape
from openvino.runtime import Type, Shape
from tests.runtime import get_runtime
from tests.test_ngraph.util import run_op_node
@@ -3,7 +3,7 @@
import numpy as np
import openvino.runtime.opset8 as ov
from openvino.runtime.impl import Shape, Type
from openvino.runtime import Shape, Type
def test_log_softmax():
@@ -10,8 +10,8 @@ import numpy as np
import pytest
import openvino.runtime.opset8 as ov
from openvino.runtime.impl import Function, PartialShape, Shape
from openvino.runtime.impl.passes import Manager
from openvino.runtime import Function, PartialShape, Shape
from openvino.runtime.passes import Manager
from tests.test_ngraph.util import count_ops_of_type
from openvino.runtime import Core
@@ -6,8 +6,8 @@
import numpy as np
import openvino.runtime.opset8 as ov
from openvino.runtime.impl import AxisSet, Function, Shape, Type
from openvino.runtime.impl.op import Constant, Parameter
from openvino.runtime import AxisSet, Function, Shape, Type
from openvino.runtime.op import Constant, Parameter
from tests.runtime import get_runtime
@@ -4,7 +4,7 @@
import numpy as np
import openvino.runtime.opset8 as ov
from openvino.runtime.impl import Type
from openvino.runtime import Type
def test_scatter_update_props():
@@ -5,7 +5,7 @@ import numpy as np
import pytest
import openvino.runtime.opset8 as ov
from openvino.runtime.impl import Shape, Type
from openvino.runtime import Shape, Type
from tests.runtime import get_runtime
from tests.test_ngraph.util import run_op_node
@@ -1,8 +1,8 @@
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.runtime.impl import PartialShape, Type
from openvino.runtime.impl.op.util import VariableInfo, Variable
from openvino.runtime import PartialShape, Type
from openvino.runtime.op.util import VariableInfo, Variable
def test_info_as_property():
@@ -6,7 +6,7 @@ import pytest
import openvino.runtime as ov
import openvino.runtime.opset8 as ops
from openvino.runtime.impl import Function, Output, Type
from openvino.runtime import Function, Output, Type
from openvino.runtime.utils.decorators import custom_preprocess_function
from openvino.runtime import Core
from tests.runtime import get_runtime
@@ -3,7 +3,7 @@
import numpy as np
import openvino.runtime.opset8 as ov
from openvino.runtime.impl import Shape, Type
from openvino.runtime import Shape, Type
def test_proposal_props():
@@ -3,7 +3,7 @@
import numpy as np
import openvino.runtime.opset8 as ov
from openvino.runtime.impl import Shape, Type
from openvino.runtime import Shape, Type
def test_swish_props_with_beta():
@@ -3,7 +3,7 @@
import numpy as np
import openvino.runtime as ov
from openvino.runtime.impl import Shape
from openvino.runtime import Shape
def test_get_constant_from_source_success():
@@ -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.impl.util.get_constant_from_source(reshape.input(1).get_source_output())
folded_const = ov.util.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.impl.util.get_constant_from_source(reshape.input(1).get_source_output())
folded_const = ov.util.get_constant_from_source(reshape.input(1).get_source_output())
assert folded_const is None
@@ -4,7 +4,7 @@
from collections import defaultdict
import datetime
from openvino.runtime import Core, Function, PartialShape, Dimension, Layout
from openvino.runtime.impl import Type
from openvino.runtime import Type
from openvino.preprocess import PrePostProcessor
from openvino.offline_transformations_pybind import serialize
@@ -53,7 +53,7 @@ def import_core_modules(silent: bool, path_to_module: str):
from openvino.offline_transformations_pybind import generate_mapping_file, apply_make_stateful_transformation, serialize # pylint: disable=import-error,no-name-in-module
from openvino.runtime import Function, get_version # pylint: disable=import-error,no-name-in-module
from openvino.runtime.impl.op import Parameter # pylint: disable=import-error,no-name-in-module
from openvino.runtime.op import Parameter # pylint: disable=import-error,no-name-in-module
from openvino.runtime import PartialShape, Dimension # pylint: disable=import-error,no-name-in-module
from openvino.frontend import FrontEndManager, FrontEnd # pylint: disable=no-name-in-module,import-error