Skip to content

Commit

Permalink
Merge branch 'master' into rounding_guard
Browse files Browse the repository at this point in the history
  • Loading branch information
mlukasze authored Jul 5, 2023
2 parents a2fdc19 + 35e2690 commit 3c5b56c
Show file tree
Hide file tree
Showing 158 changed files with 1,193 additions and 4,393 deletions.
6 changes: 4 additions & 2 deletions .ci/azure/linux_debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ jobs:
# TODO: fix 'No mock frontend API available'
$(TEST_VENV)/bin/python3 -m pip install openvino-dev --find-links=$(INSTALL_DIR)/tools
$(TEST_VENV)/bin/python3 -m pytest -s $(INSTALL_TEST_DIR)/mo/unit_tests --junitxml=$(INSTALL_TEST_DIR)/TEST-ModelOptimizer.xml
env:
PYTHONPATH: $(REPO_DIR)/tools/ovc/
displayName: 'Model Optimizer UT'
# run not all smoke filter to save time in post-commit
Expand Down Expand Up @@ -388,14 +390,14 @@ jobs:
$(TEST_VENV)/bin/python3 -m pip install -r $(LAYER_TESTS_DIR)/requirements.txt
$(TEST_VENV)/bin/python3 -m pytest $(LAYER_TESTS_DIR)/tensorflow_tests/test_tf_Roll.py --ir_version=10 --junitxml=$(INSTALL_TEST_DIR)/TEST-tf_Roll.xmlTEST
env:
PYTHONPATH: $(LAYER_TESTS_DIR)
PYTHONPATH: $(REPO_DIR)/tools/ovc/:$(LAYER_TESTS_DIR)
displayName: 'TensorFlow 1 Layer Tests - Legacy FE'
- script: |
$(TEST_VENV)/bin/python3 -m pip install -r $(LAYER_TESTS_DIR)/requirements.txt
$(RUN_PREFIX) $(TEST_VENV)/bin/python3 -m pytest $(LAYER_TESTS_DIR)/tensorflow_lite_tests/ --junitxml=$(INSTALL_TEST_DIR)/TEST-tfl_fe.xmlTEST
env:
PYTHONPATH: $(REPO_DIR)/tools/mo/:$(LAYER_TESTS_DIR)
PYTHONPATH: $(REPO_DIR)/tools/ovc/:$(REPO_DIR)/tools/mo/:$(LAYER_TESTS_DIR)
TEST_DEVICE: CPU
displayName: 'TensorFlow Lite Layer Tests - TFL FE'
Expand Down
1 change: 0 additions & 1 deletion .ci/azure/linux_onnxruntime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ jobs:
-DENABLE_CPPLINT=OFF
-DENABLE_PROFILING_ITT=OFF
-DENABLE_SAMPLES=OFF
-DENABLE_COMPILE_TOOL=OFF
-DENABLE_OV_TF_FRONTEND=OFF
-DENABLE_OV_PADDLE_FRONTEND=OFF
-DENABLE_OV_PYTORCH_FRONTEND=OFF
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ endif()
include(thirdparty/dependencies.cmake)
add_subdirectory(src)

if(ENABLE_SAMPLES OR ENABLE_TESTS OR ENABLE_COMPILE_TOOL)
if(ENABLE_SAMPLES OR ENABLE_TESTS)
add_subdirectory(samples)
endif()

Expand Down
4 changes: 2 additions & 2 deletions cmake/extra_modules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function(ie_generate_dev_package_config)
add_custom_target(ie_dev_targets DEPENDS ${all_dev_targets})

set(PATH_VARS "OpenVINO_SOURCE_DIR")
if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
if(ENABLE_SAMPLES OR ENABLE_TESTS)
list(APPEND PATH_VARS "gflags_BINARY_DIR")
# if we've found system gflags
if(gflags_DIR)
Expand Down Expand Up @@ -52,7 +52,7 @@ function(ov_generate_dev_package_config)
add_custom_target(ov_dev_targets DEPENDS ${all_dev_targets})

set(PATH_VARS "OpenVINO_SOURCE_DIR")
if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
if(ENABLE_SAMPLES OR ENABLE_TESTS)
list(APPEND PATH_VARS "gflags_BINARY_DIR")
# if we've found system gflags
if(gflags_DIR)
Expand Down
2 changes: 0 additions & 2 deletions cmake/features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ ie_dependent_option (ENABLE_ARM_COMPUTE_CMAKE "Enable ARM Compute build via cmak

ie_option (ENABLE_TESTS "unit, behavior and functional tests" OFF)

ie_option (ENABLE_COMPILE_TOOL "Enables compile_tool" ON)

ie_option (ENABLE_STRICT_DEPENDENCIES "Skip configuring \"convinient\" dependencies for efficient parallel builds" ON)

if(X86_64)
Expand Down
4 changes: 2 additions & 2 deletions conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ade/0.1.2a
onetbb/[>=2021.2.1]
pugixml/[>=1.10]
protobuf/[>=3.20.3]
protobuf/3.21.9
ittapi/[>=3.23.0]
zlib/[>=1.2.8]
opencl-icd-loader/2023.04.17
Expand All @@ -19,7 +19,7 @@ flatbuffers/[>=22.9.24]
[tool_requires]
cmake/[>=3.15]
patchelf/[>=0.12]
protobuf/[>=3.20.3]
protobuf/3.21.9
flatbuffers/[>=22.9.24]

[options]
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ OpenVINO™ Documentation
.. toctree::

home
Install <openvino_docs_install_guides_overview>
Install <https://docs.openvino.ai/install>
Blog <https://blog.openvino.ai/>
Forum <https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/bd-p/distribution-openvino-toolkit>
Support <https://www.intel.com/content/www/us/en/support/products/96066/software/development-software/openvino-toolkit.html>
Expand Down
3 changes: 1 addition & 2 deletions samples/cpp/benchmark_app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ bool parse_and_check_command_line(int argc, char* argv[]) {
bool isPrecisionSet = !(FLAGS_ip.empty() && FLAGS_op.empty() && FLAGS_iop.empty());
if (isNetworkCompiled && isPrecisionSet) {
std::string err = std::string("Cannot set precision for a compiled model. ") +
std::string("Please re-compile your model with required precision "
"using compile_tool");
std::string("Please re-compile your model with required precision.");

throw std::logic_error(err);
}
Expand Down
5 changes: 0 additions & 5 deletions scripts/setupvars/setupvars.bat
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ if exist %INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb (
)
)

:: Compile tool
if exist %INTEL_OPENVINO_DIR%\tools\compile_tool (
set "PATH=%INTEL_OPENVINO_DIR%\tools\compile_tool;%PATH%"
)

:: Add libs dirs to the PATH
set "PATH=%OPENVINO_LIB_PATHS%;%PATH%"

Expand Down
4 changes: 0 additions & 4 deletions scripts/setupvars/setupvars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ if [ -e "$INSTALLDIR/runtime" ]; then
fi
fi

if [ -e "$INSTALLDIR/tools/compile_tool" ]; then
export LD_LIBRARY_PATH=$INSTALLDIR/tools/compile_tool${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
fi

# OpenCV environment
if [ -f "$INSTALLDIR/opencv/setupvars.sh" ]; then
# shellcheck source=/dev/null
Expand Down
1 change: 1 addition & 0 deletions src/bindings/python/src/openvino/runtime/op/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""
Constant.get_data = lambda self: np.array(self, copy=True)

from openvino._pyopenvino.op import assign
from openvino._pyopenvino.op import Parameter
from openvino._pyopenvino.op import if_op
from openvino._pyopenvino.op import loop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from openvino.runtime.opset1.ops import add
from openvino.runtime.opset1.ops import asin
from openvino.runtime.opset4.ops import asinh
from openvino.runtime.opset3.ops import assign
from openvino.runtime.opset6.ops import assign
from openvino.runtime.opset1.ops import atan
from openvino.runtime.opset4.ops import atanh
from openvino.runtime.opset1.ops import avg_pool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from openvino.runtime.opset1.ops import add
from openvino.runtime.opset1.ops import asin
from openvino.runtime.opset4.ops import asinh
from openvino.runtime.opset3.ops import assign
from openvino.runtime.opset6.ops import assign
from openvino.runtime.opset1.ops import atan
from openvino.runtime.opset4.ops import atanh
from openvino.runtime.opset1.ops import avg_pool
Expand Down
18 changes: 1 addition & 17 deletions src/bindings/python/src/openvino/runtime/opset6/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from functools import partial

from openvino.runtime import Node, Shape
from openvino.runtime.op import Constant, Parameter
from openvino.runtime.op import assign, 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 (
Expand Down Expand Up @@ -124,22 +124,6 @@ def mvn(
return _get_node_factory_opset6().create("MVN", inputs, attributes)


@nameable_op
def assign(new_value: NodeInput, variable_id: str, name: Optional[str] = None) -> Node:
"""Return a node which produces the Assign operation.
:param new_value: Node producing a value to be assigned to a variable.
:param variable_id: Id of a variable to be updated.
:param name: Optional name for output node.
:return: Assign node
"""
return _get_node_factory_opset6().create(
"Assign",
[as_node(new_value)],
{"variable_id": variable_id},
)


@nameable_op
def read_value(init_value: NodeInput, variable_id: str, name: Optional[str] = None) -> Node:
"""Return a node which produces the Assign operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from openvino.runtime.opset1.ops import add
from openvino.runtime.opset1.ops import asin
from openvino.runtime.opset4.ops import asinh
from openvino.runtime.opset3.ops import assign
from openvino.runtime.opset6.ops import assign
from openvino.runtime.opset1.ops import atan
from openvino.runtime.opset4.ops import atanh
from openvino.runtime.opset1.ops import avg_pool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from openvino.runtime.opset1.ops import add
from openvino.runtime.opset1.ops import asin
from openvino.runtime.opset4.ops import asinh
from openvino.runtime.opset3.ops import assign
from openvino.runtime.opset6.ops import assign
from openvino.runtime.opset1.ops import atan
from openvino.runtime.opset4.ops import atanh
from openvino.runtime.opset1.ops import avg_pool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from openvino.runtime.opset1.ops import add
from openvino.runtime.opset1.ops import asin
from openvino.runtime.opset4.ops import asinh
from openvino.runtime.opset3.ops import assign
from openvino.runtime.opset6.ops import assign
from openvino.runtime.opset1.ops import atan
from openvino.runtime.opset4.ops import atanh
from openvino.runtime.opset1.ops import avg_pool
Expand Down
135 changes: 135 additions & 0 deletions src/bindings/python/src/pyopenvino/graph/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "openvino/core/graph_util.hpp"
#include "openvino/core/model.hpp" // ov::Model
#include "openvino/core/partial_shape.hpp"
#include "openvino/op/assign.hpp"
#include "openvino/op/parameter.hpp" // ov::op::v0::Parameter
#include "openvino/op/sink.hpp"
#include "pyopenvino/core/common.hpp"
Expand Down Expand Up @@ -49,6 +50,16 @@ static ov::SinkVector cast_to_sink_vector(const std::vector<std::shared_ptr<ov::
return sinks;
}

static std::vector<std::shared_ptr<ov::Node>> cast_to_node_vector(const ov::SinkVector& sinks) {
std::vector<std::shared_ptr<ov::Node>> nodes;
for (const auto& sink : sinks) {
auto node = std::dynamic_pointer_cast<ov::Node>(sink);
NGRAPH_CHECK(node != nullptr, "Sink {} is not instance of Node");
nodes.push_back(node);
}
return nodes;
}

void regclass_graph_Model(py::module m) {
py::class_<ov::Model, std::shared_ptr<ov::Model>> model(m, "Model", py::module_local());
model.doc() = "openvino.runtime.Model wraps ov::Model";
Expand Down Expand Up @@ -696,6 +707,130 @@ void regclass_graph_Model(py::module m) {
:rtype: int
)");

model.def("remove_result",
&ov::Model::remove_result,
py::arg("result"),
R"(
Delete Result node from the list of results. Method will not delete node from graph.
:param result: Result node to delete.
)");

model.def("remove_parameter",
&ov::Model::remove_parameter,
py::arg("parameter"),
R"(
Delete Parameter node from the list of parameters. Method will not delete node from graph.
You need to replace Parameter with other operation manually.
Attention: Indexing of parameters can be changed.
Possible use of method is to replace input by variable. For it the following steps should be done:
* `Parameter` node should be replaced by `ReadValue`
* call remove_parameter(param) to remove input from the list
* check if any parameter indexes are saved/used somewhere, update it for all inputs because indexes can be changed
* call graph validation to check all changes
:param parameter: Parameter node to delete.
)");

model.def(
"remove_sink",
[](ov::Model& self, const py::object& node) {
if (py::isinstance<ov::op::v6::Assign>(node)) {
auto sink = std::dynamic_pointer_cast<ov::op::Sink>(node.cast<std::shared_ptr<ov::op::v6::Assign>>());
self.remove_sink(sink);
} else if (py::isinstance<ov::Node>(node)) {
auto sink = std::dynamic_pointer_cast<ov::op::Sink>(node.cast<std::shared_ptr<ov::Node>>());
self.remove_sink(sink);
} else {
throw py::type_error("Incorrect argument type. Sink node is expected as an argument.");
}
},
py::arg("sink"),
R"(
Delete sink node from the list of sinks. Method doesn't delete node from graph.
:param sink: Sink to delete.
)");

model.def("add_parameters",
&ov::Model::add_parameters,
py::arg("parameters"),
R"(
Add new Parameter nodes to the list.
Method doesn't change or validate graph, it should be done manually.
For example, if you want to replace `ReadValue` node by `Parameter`, you should do the
following steps:
* replace node `ReadValue` by `Parameter` in graph
* call add_parameter() to add new input to the list
* call graph validation to check correctness of changes
:param parameter: new Parameter nodes.
:type parameter: List[op.Parameter]
)");

model.def("add_results",
&ov::Model::add_results,
py::arg("results"),
R"(
Add new Result nodes to the list.
Method doesn't validate graph, it should be done manually after all changes.
:param results: new Result nodes.
:type results: List[op.Result]
)");

model.def(
"add_sinks",
[](ov::Model& self, py::list& sinks) {
ov::SinkVector sinks_cpp;
for (py::handle sink : sinks) {
auto sink_cpp =
std::dynamic_pointer_cast<ov::op::Sink>(sink.cast<std::shared_ptr<ov::op::v6::Assign>>());
NGRAPH_CHECK(sink_cpp != nullptr, "Assign {} is not instance of Sink");
sinks_cpp.push_back(sink_cpp);
}
self.add_sinks(sinks_cpp);
},
py::arg("sinks"),
R"(
Add new sink nodes to the list.
Method doesn't validate graph, it should be done manually after all changes.
:param sinks: new sink nodes.
:type sinks: List[openvino.runtime.Node]
)");

model.def(
"get_sinks",
[](ov::Model& self) {
auto sinks = self.get_sinks();
return cast_to_node_vector(sinks);
},
R"(
Return a list of model's sinks.
:return: a list of model's sinks.
:rtype: List[openvino.runtime.Node]
)");

model.def_property_readonly(
"sinks",
[](ov::Model& self) {
auto sinks = self.get_sinks();
return cast_to_node_vector(sinks);
},
R"(
Return a list of model outputs.
:return: ResultVector containing model parameters.
:rtype: ResultVector
)");

model.def(
"evaluate",
[](ov::Model& self,
Expand Down
Loading

0 comments on commit 3c5b56c

Please sign in to comment.