Skip to content

Commit 9bdd36b

Browse files
[Core] Remove ngraph env_util.hpp graph_util.hpp util.hpp (openvinotoolkit#22540)
* Delete env_util * Remove ngraph graph_util (initial) TODO: remove ngraph/graph_util.hpp and remains from graph_util.cpp * Remove ngraph util (initial) TODO: remove ngraph/util.hpp and remains from util.cpp * Remove ngraph util (onnx fe not finished) TODO: remove ngraph/util.hpp and util.cpp. * Use OV in test helpers * Remove ngraph graph_util * [ONNX FE] Rename onnx_import::Node class to ONNX_Node temporarily (to hide conflicts with missing Node from ::ngraph::) * Remove ngraph graph_util from onnx fe * [ONNX FE] Rename onnx_import::ONNX_Node class back to Node * Delete ngraph util * Update copyright notes * Update copyright notes * Fix style * Fix gpu plugin * Remove useless macros --------- Co-authored-by: Pavel Durandin <pavel.durandin@intel.com>
1 parent 75ee009 commit 9bdd36b

File tree

145 files changed

+886
-2276
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+886
-2276
lines changed

docs/snippets/ov_model_snippets.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ auto pow = std::make_shared<ov::opset8::Power>(div->input(1).get_source_output()
297297
ov::op::v0::Constant::create(div->get_input_element_type(1), ov::Shape{1}, {-1}));
298298
auto mul = std::make_shared<ov::opset8::Multiply>(div->input(0).get_source_output(), pow);
299299
mul->set_friendly_name(div->get_friendly_name());
300-
ngraph::replace_node(div, mul);
300+
ov::replace_node(div, mul);
301301
// ! [ov:replace_friendly_name]
302302
}
303303

docs/snippets/ov_preprocessing.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
// Copyright (C) 2018-2023 Intel Corporation
1+
// Copyright (C) 2018-2024 Intel Corporation
22
// SPDX-License-Identifier: Apache-2.0
33
//
4-
#include <openvino/runtime/core.hpp>
5-
#include <openvino/opsets/opset8.hpp>
6-
#include <openvino/core/preprocess/pre_post_process.hpp>
4+
#include "openvino/core/graph_util.hpp"
5+
#include "openvino/core/preprocess/pre_post_process.hpp"
6+
#include "openvino/opsets/opset8.hpp"
7+
#include "openvino/runtime/core.hpp"
78

89
void ppp_input_1(ov::preprocess::PrePostProcessor& ppp) {
910
//! [ov:preprocess:input_1]

docs/snippets/template_pattern_transformation.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
// Copyright (C) 2018-2023 Intel Corporation
1+
// Copyright (C) 2018-2024 Intel Corporation
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

55
#include "template_pattern_transformation.hpp"
66

77
#include "openvino/cc/pass/itt.hpp"
8+
#include "openvino/core/graph_util.hpp"
89
#include "openvino/core/rt_info.hpp"
910
#include "openvino/opsets/opset3.hpp"
1011
#include "openvino/pass/manager.hpp"

src/common/snippets/src/lowered/linear_ir.cpp

+58-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2023 Intel Corporation
1+
// Copyright (C) 2023-2024 Intel Corporation
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

@@ -104,6 +104,61 @@ ov::NodeVector LinearIR::get_ordered_ops(const std::shared_ptr<ov::Model>& m) {
104104
return ov::topological_sort(nodes);
105105
}
106106

107+
namespace {
108+
using NodeMap = std::unordered_map<ov::Node*, std::shared_ptr<ov::Node>>;
109+
110+
std::vector<std::shared_ptr<ov::Node>> clone_nodes(const std::vector<std::shared_ptr<ov::Node>>& nodes,
111+
NodeMap& node_map) {
112+
// for each node in topological order
113+
auto sorted_nodes = topological_sort(nodes);
114+
for (const auto& node : sorted_nodes) {
115+
if (node_map.count(node.get()) == 0) {
116+
// get (already) cloned arguments and clone the node
117+
OutputVector cloned_args;
118+
for (auto input : node->inputs()) {
119+
ov::Output<Node> output = input.get_source_output();
120+
cloned_args.push_back(output.for_node(node_map.at(output.get_node())));
121+
}
122+
std::vector<std::shared_ptr<Node>> cloned_dependencies;
123+
for (auto& dependency : node->get_control_dependencies()) {
124+
std::shared_ptr<Node>& dependent = node_map.at(dependency.get());
125+
if (find(cloned_dependencies.begin(), cloned_dependencies.end(), dependent) ==
126+
cloned_dependencies.end()) {
127+
cloned_dependencies.push_back(dependent);
128+
}
129+
}
130+
auto cloned_node = node->copy_with_new_inputs(cloned_args, cloned_dependencies);
131+
// There is a friendly name for this node so copy it
132+
cloned_node->set_friendly_name(node->get_friendly_name());
133+
auto rt_info = node->get_rt_info();
134+
cloned_node->get_rt_info() = rt_info;
135+
136+
for (auto output : node->outputs()) {
137+
const auto& output_rt_info = output.get_rt_info();
138+
auto new_output = output.for_node(cloned_node);
139+
new_output.get_rt_info() = output_rt_info;
140+
}
141+
142+
for (auto input : node->inputs()) {
143+
const auto& output_rt_info = input.get_rt_info();
144+
auto new_input = cloned_node->input(input.get_index());
145+
new_input.get_rt_info() = output_rt_info;
146+
}
147+
148+
node_map[node.get()] = cloned_node;
149+
}
150+
}
151+
152+
// create and return vector of cloned nodes
153+
// order matches input vector (not necessarily topological)
154+
std::vector<std::shared_ptr<ov::Node>> cloned_nodes;
155+
for (const auto& node : nodes) {
156+
cloned_nodes.push_back(node_map.at(node.get()));
157+
}
158+
return cloned_nodes;
159+
}
160+
} // namespace
161+
107162
LinearIR::container LinearIR::deep_copy_range(LinearIR::container::const_iterator begin,
108163
LinearIR::container::const_iterator end,
109164
ExressionMap& expression_map) {
@@ -115,10 +170,8 @@ LinearIR::container LinearIR::deep_copy_range(LinearIR::container::const_iterato
115170
}
116171

117172
// node_map and expr_map map original node pointer (expression) to a new pointer (expression)
118-
ngraph::NodeMap node_map;
119-
OPENVINO_SUPPRESS_DEPRECATED_START
120-
ngraph::clone_nodes(original_nodes, node_map);
121-
OPENVINO_SUPPRESS_DEPRECATED_END
173+
NodeMap node_map;
174+
clone_nodes(original_nodes, node_map);
122175

123176
for (auto it = begin; it != end; it++) {
124177
const auto& expr = *it;

src/core/include/ngraph/env_util.hpp

-55
This file was deleted.

0 commit comments

Comments
 (0)