Skip to content

Commit

Permalink
[core] Remove ngraph/output_vector API (openvinotoolkit#22446)
Browse files Browse the repository at this point in the history
* Remove ngraph/output_vector API

* Fix build issue
  • Loading branch information
praasz authored Jan 28, 2024
1 parent 8922564 commit a16bc97
Show file tree
Hide file tree
Showing 355 changed files with 673 additions and 692 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST_F(TransformationTestsF, FQTransposeTest1) {
auto fq = std::make_shared<ov::op::v0::FakeQuantize>(data, input_low, input_high, output_low, output_high, 1);
auto transpose = std::make_shared<ov::op::v1::Transpose>(fq, transpose_order);

model = std::make_shared<ov::Model>(NodeVector{transpose}, ParameterVector{});
model = std::make_shared<ov::Model>(ov::NodeVector{transpose}, ParameterVector{});

manager.register_pass<ov::pass::PullTransposeThroughFQUp>();
manager.register_pass<ov::pass::InjectionPass>([](std::shared_ptr<ov::Model> f) {
Expand All @@ -54,7 +54,7 @@ TEST_F(TransformationTestsF, FQTransposeTest1) {

auto fq = std::make_shared<ov::op::v0::FakeQuantize>(data, input_low, input_high, output_low, output_high, 1);

model_ref = std::make_shared<ov::Model>(NodeVector{fq}, ParameterVector{});
model_ref = std::make_shared<ov::Model>(ov::NodeVector{fq}, ParameterVector{});
}
}

Expand All @@ -72,7 +72,7 @@ TEST_F(TransformationTestsF, FQTransposeNegativeCase) {
std::make_shared<ov::op::v0::FakeQuantize>(sigmoid, input_low, input_high, output_low, output_high, 1);
auto transpose = std::make_shared<ov::op::v1::Transpose>(fq, transpose_order);

return std::make_shared<ov::Model>(NodeVector{transpose}, ParameterVector{data});
return std::make_shared<ov::Model>(ov::NodeVector{transpose}, ParameterVector{data});
};
model = create_graph();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TEST(TransformationTests, TestDepthToSpaceTransformBlockFirst) {
{
auto depth_to_space =
std::make_shared<op::v0::DepthToSpace>(input, op::v0::DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST, 2);
f = std::make_shared<ov::Model>(NodeVector{depth_to_space}, ParameterVector{input});
f = std::make_shared<ov::Model>(ov::NodeVector{depth_to_space}, ParameterVector{input});
pass::Manager m;
m.register_pass<ov::pass::InitNodeInfo>();
m.register_pass<ov::pass::ConvertDepthToSpace>();
Expand Down Expand Up @@ -73,7 +73,7 @@ TEST(TransformationTests, TestDepthToSpaceTransformDepthFirst) {
{
auto depth_to_space =
std::make_shared<op::v0::DepthToSpace>(input, op::v0::DepthToSpace::DepthToSpaceMode::DEPTH_FIRST, 2);
f = std::make_shared<ov::Model>(NodeVector{depth_to_space}, ParameterVector{input});
f = std::make_shared<ov::Model>(ov::NodeVector{depth_to_space}, ParameterVector{input});
pass::Manager m;
m.register_pass<ov::pass::InitNodeInfo>();
m.register_pass<ov::pass::ConvertDepthToSpace>();
Expand Down Expand Up @@ -117,7 +117,7 @@ TEST(TransformationTests, TestSpaceToDepthTransformBlockFirst) {
{
auto space_to_depth =
std::make_shared<op::v0::SpaceToDepth>(input, op::v0::SpaceToDepth::SpaceToDepthMode::BLOCKS_FIRST, 2);
f = std::make_shared<ov::Model>(NodeVector{space_to_depth}, ParameterVector{input});
f = std::make_shared<ov::Model>(ov::NodeVector{space_to_depth}, ParameterVector{input});
pass::Manager m;
m.register_pass<ov::pass::InitNodeInfo>();
m.register_pass<ov::pass::ConvertSpaceToDepth>();
Expand Down Expand Up @@ -161,7 +161,7 @@ TEST(TransformationTests, TestSpaceToDepthTransformDepthFirst) {
{
auto space_to_depth =
std::make_shared<op::v0::SpaceToDepth>(input, op::v0::SpaceToDepth::SpaceToDepthMode::DEPTH_FIRST, 2);
f = std::make_shared<ov::Model>(NodeVector{space_to_depth}, ParameterVector{input});
f = std::make_shared<ov::Model>(ov::NodeVector{space_to_depth}, ParameterVector{input});
pass::Manager m;
m.register_pass<ov::pass::InitNodeInfo>();
m.register_pass<ov::pass::ConvertSpaceToDepth>();
Expand Down Expand Up @@ -205,7 +205,7 @@ TEST(TransformationTests, TestSpaceToDepthDynamic) {
{
auto space_to_depth =
std::make_shared<op::v0::SpaceToDepth>(input, op::v0::SpaceToDepth::SpaceToDepthMode::DEPTH_FIRST, 2);
f = std::make_shared<ov::Model>(NodeVector{space_to_depth}, ParameterVector{input});
f = std::make_shared<ov::Model>(ov::NodeVector{space_to_depth}, ParameterVector{input});
pass::Manager m;
m.register_pass<ov::pass::ConvertSpaceToDepth>();
ASSERT_NO_THROW(m.run_passes(f));
Expand All @@ -219,7 +219,7 @@ TEST(TransformationTests, TestDepthToSpaceDynamic) {
{
auto depth_to_space =
std::make_shared<op::v0::DepthToSpace>(input, op::v0::DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST, 2);
f = std::make_shared<ov::Model>(NodeVector{depth_to_space}, ParameterVector{input});
f = std::make_shared<ov::Model>(ov::NodeVector{depth_to_space}, ParameterVector{input});
pass::Manager m;
m.register_pass<ov::pass::ConvertDepthToSpace>();
ASSERT_NO_THROW(m.run_passes(f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TEST(TransformationTests, ModDecompositionTests) {
{
auto mod = std::make_shared<op::v1::Mod>(data1, data2);

f = std::make_shared<ov::Model>(NodeVector{mod}, ParameterVector{});
f = std::make_shared<ov::Model>(ov::NodeVector{mod}, ParameterVector{});
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
pass::Manager m;
m.register_pass<ov::pass::InitUniqueNames>(unh);
Expand Down
14 changes: 7 additions & 7 deletions src/core/include/ngraph/graph_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ using ov::traverse_nodes;

NGRAPH_API_DEPRECATED
NGRAPH_API
NodeVector find_common_args(std::shared_ptr<Node> target, std::shared_ptr<Node> replacement);
ov::NodeVector find_common_args(std::shared_ptr<Node> target, std::shared_ptr<Node> replacement);

/// Topological sort of just nodes
template <typename T>
Expand Down Expand Up @@ -169,17 +169,17 @@ bool is_zero(const ov::Output<Node>& reduce_constant);

NGRAPH_API_DEPRECATED
NGRAPH_API
NodeVector get_subgraph_outputs(const NodeVector& nodes,
const NodeVector& exclusions,
bool ignore_unused = false,
bool ignore_output_duplicates = true);
ov::NodeVector get_subgraph_outputs(const ov::NodeVector& nodes,
const ov::NodeVector& exclusions,
bool ignore_unused = false,
bool ignore_output_duplicates = true);

// Extract sub-graph computing the `results`. Stops backward traversal at either a Parameter
// node
// or a node that belongs to args
NGRAPH_API_DEPRECATED
NGRAPH_API
NodeVector extract_subgraph(const NodeVector& results, const NodeVector& args);
ov::NodeVector extract_subgraph(const ov::NodeVector& results, const ov::NodeVector& args);

NGRAPH_API_DEPRECATED
NGRAPH_API
Expand Down Expand Up @@ -226,7 +226,7 @@ std::vector<ov::Output<Node>> get_outputs_to(Node& src, Node& dst);
/// It returns true if a cycle is found and the first cycle encountered.
NGRAPH_API_DEPRECATED
NGRAPH_API
bool check_for_cycles(const ov::Model* func, ngraph::NodeVector& cycle_nodes, bool& is_bkwd_cycle);
bool check_for_cycles(const ov::Model* func, ov::NodeVector& cycle_nodes, bool& is_bkwd_cycle);
} // namespace ngraph

using ngraph::replace_node;
Expand Down
4 changes: 2 additions & 2 deletions src/core/include/ngraph/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
#include "ngraph/coordinate_diff.hpp"
#include "ngraph/deprecated.hpp"
#include "ngraph/op/util/attr_types.hpp"
#include "ngraph/output_vector.hpp"
#include "ngraph/strides.hpp"
#include "openvino/core/any.hpp"
#include "openvino/core/descriptor/input.hpp"
#include "openvino/core/descriptor/output.hpp"
#include "openvino/core/descriptor/tensor.hpp"
#include "openvino/core/node.hpp"
#include "openvino/core/node_vector.hpp"
#include "openvino/op/util/variable.hpp"
#include "openvino/op/util/variable_value.hpp"

Expand Down Expand Up @@ -69,7 +69,7 @@ NGRAPH_API_DEPRECATED
const std::shared_ptr<Node>& check_single_output_arg(const std::shared_ptr<Node>& node, size_t i);
NGRAPH_API
NGRAPH_API_DEPRECATED
const NodeVector& check_single_output_args(const NodeVector& args);
const ov::NodeVector& check_single_output_args(const ov::NodeVector& args);

const auto as_output_vector = ov::as_output_vector;
const auto as_node_vector = ov::as_node_vector;
Expand Down
26 changes: 0 additions & 26 deletions src/core/include/ngraph/output_vector.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion src/core/include/ngraph/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,5 @@ std::vector<int64_t> NGRAPH_API read_index_vector(std::shared_ptr<ov::Tensor> tv

NGRAPH_API
NGRAPH_API_DEPRECATED
std::ostream& operator<<(std::ostream& os, const ngraph::NodeVector& nv);
std::ostream& operator<<(std::ostream& os, const ov::NodeVector& nv);
NGRAPH_SUPPRESS_DEPRECATED_END
22 changes: 11 additions & 11 deletions src/core/src/graph_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,17 +352,17 @@ ov::NodeVector find_common_args(std::shared_ptr<Node> node1, std::shared_ptr<Nod
node1_args.insert(node);
};

traverse_nodes({std::move(node1)}, compute_node1_args, NodeVector{});
traverse_nodes({std::move(node1)}, compute_node1_args, ov::NodeVector{});

std::unordered_set<std::shared_ptr<Node>> node2_args;

auto compute_node2_args = [&node2_args](const std::shared_ptr<Node>& node) {
node2_args.insert(node);
};

traverse_nodes({std::move(node2)}, compute_node2_args, NodeVector{});
traverse_nodes({std::move(node2)}, compute_node2_args, ov::NodeVector{});

NodeVector common_args;
ov::NodeVector common_args;
for (const auto& e : node1_args) {
if (node2_args.count(e) > 0) {
common_args.push_back(e);
Expand Down Expand Up @@ -403,7 +403,7 @@ std::vector<std::shared_ptr<ov::Node>> clone_nodes(const std::vector<std::shared
for (const auto& node : sorted_nodes) {
if (node_map.count(node.get()) == 0) {
// get (already) cloned arguments and clone the node
OutputVector cloned_args;
ov::OutputVector cloned_args;
for (auto input : node->inputs()) {
ov::Output<Node> output = input.get_source_output();
cloned_args.push_back(output.for_node(node_map.at(output.get_node())));
Expand Down Expand Up @@ -458,11 +458,11 @@ std::list<std::shared_ptr<ov::Node>> clone_nodes(const std::vector<std::shared_p
if (output_map.count(value) == 0) {
// We need this node cloned
// get (already) cloned arguments and clone the node
OutputVector cloned_args;
ov::OutputVector cloned_args;
for (const auto& value : node->input_values()) {
cloned_args.push_back(output_map.at(value));
}
NodeVector cloned_dependencies;
ov::NodeVector cloned_dependencies;
for (auto& dependency : node->get_control_dependencies()) {
for (const auto& dependency_value : dependency->outputs()) {
std::shared_ptr<Node> dependent = output_map.at(dependency_value).get_node_shared_ptr();
Expand Down Expand Up @@ -636,14 +636,14 @@ bool is_one(const ov::Output<Node>& reduce_constant) {
return result_bool;
}

ov::NodeVector get_subgraph_outputs(const NodeVector& nodes,
const NodeVector& exclusions,
ov::NodeVector get_subgraph_outputs(const ov::NodeVector& nodes,
const ov::NodeVector& exclusions,
bool ignore_unused,
bool ignore_output_duplicates) {
std::set<std::shared_ptr<Node>> exclusions_set(exclusions.begin(), exclusions.end());
std::set<std::shared_ptr<Node>> nodes_set(nodes.begin(), nodes.end());

NodeVector outputs;
ov::NodeVector outputs;

for (const auto& n : nodes) {
if (exclusions_set.count(n) != 0) {
Expand All @@ -662,8 +662,8 @@ ov::NodeVector get_subgraph_outputs(const NodeVector& nodes,
return outputs;
}

ov::NodeVector extract_subgraph(const NodeVector& results, const NodeVector& args) {
NodeVector subgraph;
ov::NodeVector extract_subgraph(const ov::NodeVector& results, const ov::NodeVector& args) {
ov::NodeVector subgraph;
traverse_nodes(
results,
[&](const std::shared_ptr<Node>& n) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ const std::shared_ptr<ov::Node>& ngraph::check_single_output_arg(const std::shar
return node;
}

const ov::NodeVector& ngraph::check_single_output_args(const NodeVector& args) {
const ov::NodeVector& ngraph::check_single_output_args(const ov::NodeVector& args) {
for (size_t i = 0; i < args.size(); ++i) {
ngraph::check_single_output_arg(args.at(i), i);
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/src/specialize_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ std::shared_ptr<ov::Model> ngraph::specialize_function(std::shared_ptr<ov::Model
continue;
}

OutputVector new_args;
ov::OutputVector new_args;
for (auto input : old_node->inputs()) {
auto output = input.get_source_output();
new_args.push_back(output.for_node(m[output.get_node()]));
}

NodeVector cloned_dependencies;
ov::NodeVector cloned_dependencies;
for (auto& dependency : old_node->get_control_dependencies()) {
std::shared_ptr<Node> dependent = m.at(dependency.get());
if (find(cloned_dependencies.begin(), cloned_dependencies.end(), dependent) == cloned_dependencies.end()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "ngraph/output_vector.hpp"
#include "openvino/core/node_vector.hpp"
#include "openvino/frontend/visibility.hpp"
#include "openvino/pass/graph_rewrite.hpp"

Expand Down
2 changes: 1 addition & 1 deletion src/frontends/common/src/random_normal_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <math.h>

#include "ngraph/output_vector.hpp"
#include "openvino/core/node_vector.hpp"
#include "openvino/op/constant.hpp"
#include "openvino/opsets/opset12.hpp"
#include "openvino/pass/graph_rewrite.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/frontends/onnx/docs/how_to_add_op.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace onnx_import {
namespace op {
namespace set_1 {

OutputVector custom_add(const Node& node);
ov::OutputVector custom_add(const Node& node);

} // namespace set_1
} // namespace op
Expand All @@ -38,7 +38,7 @@ namespace onnx_import {
namespace op {
namespace set_1 {
OutputVector custom_add(const Node& node) {
ov::OutputVector custom_add(const Node& node) {
const auto in1 = node.get_ng_inputs().at(0);
const auto in2 = node.get_ng_inputs().at(1);
const auto alpha = node.get_attribute_value<float>("alpha", 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class NGRAPH_API_DEPRECATED ONNX_IMPORTER_API Node {
Node& operator=(Node&&) noexcept = delete;
Node& operator=(const Node&) = delete;

OutputVector get_ng_inputs() const;
ov::OutputVector get_ng_inputs() const;
const std::string& domain() const;
const std::string& op_type() const;
const std::string& get_name() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace ngraph {
namespace onnx_import {
/// \brief Function which transforms single ONNX operator to nGraph sub-graph.
OPENVINO_SUPPRESS_DEPRECATED_START
using Operator = std::function<OutputVector(const Node&)>;
using Operator = std::function<ov::OutputVector(const Node&)>;
OPENVINO_SUPPRESS_DEPRECATED_END

/// \brief Map which contains ONNX operators accessible by std::string value as a key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ class ONNX_FRONTEND_API NodeContext : public ov::frontend::NodeContext {

protected:
const ngraph::onnx_import::Node& m_context;
OutputVector m_inputs;
ov::OutputVector m_inputs;

private:
ov::Any apply_additional_conversion_rules(const ov::Any& data, const std::type_info& type_info) const override;
};
using CreatorFunction = std::function<OutputVector(const ngraph::onnx_import::Node&)>;
using CreatorFunction = std::function<ov::OutputVector(const ngraph::onnx_import::Node&)>;
} // namespace onnx
} // namespace frontend
} // namespace ov
Expand Down
Loading

0 comments on commit a16bc97

Please sign in to comment.