Skip to content

Commit

Permalink
Delete ngraph #1 (openvinotoolkit#21871)
Browse files Browse the repository at this point in the history
* Delete `ngraph/visibility.hpp`

* Delete `ngraph/log.hpp`

* Delete `ngraph/file_util.hpp`

* Delete `ngraph/type.hpp`

* Delete `ngraph/dimension.hpp`

* Delete `ngraph/coordinate.hpp`

* ClangFormat

* Fix build

* Fix pyngraph

* Remove comment

* Fix build
  • Loading branch information
vurusovs authored Jan 5, 2024
1 parent 5897360 commit 7e745c2
Show file tree
Hide file tree
Showing 44 changed files with 68 additions and 557 deletions.
11 changes: 6 additions & 5 deletions src/bindings/python/src/compatibility/pyngraph/coordinate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "ngraph/coordinate.hpp" // ngraph::Coordinate
#include "openvino/core/coordinate.hpp" // ov::Coordinate

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include "openvino/core/shape.hpp"
#include "pyngraph/coordinate.hpp"

namespace py = pybind11;

void regclass_pyngraph_Coordinate(py::module m) {
py::class_<ngraph::Coordinate, std::shared_ptr<ngraph::Coordinate>> coordinate(m, "Coordinate", py::module_local());
coordinate.doc() = "ngraph.impl.Coordinate wraps ngraph::Coordinate";
py::class_<ov::Coordinate, std::shared_ptr<ov::Coordinate>> coordinate(m, "Coordinate", py::module_local());
coordinate.doc() = "ngraph.impl.Coordinate wraps ov::Coordinate";
coordinate.def(py::init<const std::initializer_list<size_t>&>());
coordinate.def(py::init<const ngraph::Shape&>());
coordinate.def(py::init<const ov::Shape&>());
coordinate.def(py::init<const std::vector<size_t>&>());
coordinate.def(py::init<const ngraph::Coordinate&>());
coordinate.def(py::init<const ov::Coordinate&>());
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ util::DictAttributeDeserializer::DictAttributeDeserializer(

void util::DictAttributeDeserializer::on_adapter(const std::string& name, ngraph::ValueAccessor<void>& adapter) {
if (m_attributes.contains(name)) {
if (const auto& a = ngraph::as_type<
if (const auto& a = ov::as_type<
ngraph::AttributeAdapter<std::vector<std::shared_ptr<ngraph::op::util::SubGraphOp::InputDescription>>>>(
&adapter)) {
std::vector<std::shared_ptr<ngraph::op::util::SubGraphOp::InputDescription>> input_descs;
Expand Down Expand Up @@ -65,7 +65,7 @@ void util::DictAttributeDeserializer::on_adapter(const std::string& name, ngraph
}
}
a->set(input_descs);
} else if (const auto& a = ngraph::as_type<ngraph::AttributeAdapter<
} else if (const auto& a = ov::as_type<ngraph::AttributeAdapter<
std::vector<std::shared_ptr<ngraph::op::util::SubGraphOp::OutputDescription>>>>(&adapter)) {
std::vector<std::shared_ptr<ngraph::op::util::SubGraphOp::OutputDescription>> output_descs;
const py::dict& output_desc = m_attributes[name.c_str()].cast<py::dict>();
Expand Down Expand Up @@ -96,16 +96,15 @@ void util::DictAttributeDeserializer::on_adapter(const std::string& name, ngraph
}
a->set(output_descs);
} else if (const auto& a =
ngraph::as_type<ngraph::AttributeAdapter<ngraph::op::v5::Loop::SpecialBodyPorts>>(&adapter)) {
ov::as_type<ngraph::AttributeAdapter<ngraph::op::v5::Loop::SpecialBodyPorts>>(&adapter)) {
ngraph::op::v5::Loop::SpecialBodyPorts special_body_ports;
const py::dict& special_ports_dict = m_attributes[name.c_str()].cast<py::dict>();
special_body_ports.body_condition_output_idx =
special_ports_dict["body_condition_output_idx"].cast<int64_t>();
special_body_ports.current_iteration_input_idx =
special_ports_dict["current_iteration_input_idx"].cast<int64_t>();
a->set(special_body_ports);
} else if (const auto& a =
ngraph::as_type<ngraph::AttributeAdapter<std::shared_ptr<ngraph::Variable>>>(&adapter)) {
} else if (const auto& a = ov::as_type<ngraph::AttributeAdapter<std::shared_ptr<ngraph::Variable>>>(&adapter)) {
std::string variable_id = m_attributes[name.c_str()].cast<std::string>();
if (!m_variables.count(variable_id)) {
m_variables[variable_id] = std::make_shared<ngraph::Variable>(
Expand Down
38 changes: 19 additions & 19 deletions src/bindings/python/src/compatibility/pyngraph/dimension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "ngraph/dimension.hpp" // ngraph::Dimension
#include "openvino/core/dimension.hpp" // ov::Dimension

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
Expand All @@ -16,10 +16,10 @@
namespace py = pybind11;

void regclass_pyngraph_Dimension(py::module m) {
using value_type = ngraph::Dimension::value_type;
using value_type = ov::Dimension::value_type;

py::class_<ngraph::Dimension, std::shared_ptr<ngraph::Dimension>> dim(m, "Dimension", py::module_local());
dim.doc() = "ngraph.impl.Dimension wraps ngraph::Dimension";
py::class_<ov::Dimension, std::shared_ptr<ov::Dimension>> dim(m, "Dimension", py::module_local());
dim.doc() = "ngraph.impl.Dimension wraps ov::Dimension";
dim.def(py::init<>());
dim.def(py::init<value_type&>(),
py::arg("dimension"),
Expand All @@ -41,18 +41,18 @@ void regclass_pyngraph_Dimension(py::module m) {
:type max_dimension: The upper inclusive limit for the dimension.
)");

dim.def_static("dynamic", &ngraph::Dimension::dynamic);
dim.def_static("dynamic", &ov::Dimension::dynamic);

dim.def_property_readonly("is_dynamic",
&ngraph::Dimension::is_dynamic,
&ov::Dimension::is_dynamic,
R"(
Check if Dimension is dynamic.
:return: True if dynamic, else False.
:rtype: bool
)");
dim.def_property_readonly("is_static",
&ngraph::Dimension::is_static,
&ov::Dimension::is_static,
R"(
Check if Dimension is static.
Expand All @@ -62,20 +62,20 @@ void regclass_pyngraph_Dimension(py::module m) {

dim.def(
"__eq__",
[](const ngraph::Dimension& a, const ngraph::Dimension& b) {
[](const ov::Dimension& a, const ov::Dimension& b) {
return a == b;
},
py::is_operator());
dim.def(
"__eq__",
[](const ngraph::Dimension& a, const int64_t& b) {
[](const ov::Dimension& a, const int64_t& b) {
return a == b;
},
py::is_operator());

dim.def("__len__", &ngraph::Dimension::get_length);
dim.def("__len__", &ov::Dimension::get_length);
dim.def("get_length",
&ngraph::Dimension::get_length,
&ov::Dimension::get_length,
R"(
Return this dimension as integer.
This dimension must be static and non-negative.
Expand All @@ -84,7 +84,7 @@ void regclass_pyngraph_Dimension(py::module m) {
:rtype: int
)");
dim.def("get_min_length",
&ngraph::Dimension::get_min_length,
&ov::Dimension::get_min_length,
R"(
Return this dimension's min_dimension as integer.
This dimension must be dynamic and non-negative.
Expand All @@ -93,7 +93,7 @@ void regclass_pyngraph_Dimension(py::module m) {
:rtype: int
)");
dim.def("get_max_length",
&ngraph::Dimension::get_max_length,
&ov::Dimension::get_max_length,
R"(
Return this dimension's max_dimension as integer.
This dimension must be dynamic and non-negative.
Expand All @@ -103,7 +103,7 @@ void regclass_pyngraph_Dimension(py::module m) {
)");

dim.def("same_scheme",
&ngraph::Dimension::same_scheme,
&ov::Dimension::same_scheme,
py::arg("dim"),
R"(
Return this dimension's max_dimension as integer.
Expand All @@ -116,7 +116,7 @@ void regclass_pyngraph_Dimension(py::module m) {
:rtype: bool
)");
dim.def("compatible",
&ngraph::Dimension::compatible,
&ov::Dimension::compatible,
py::arg("d"),
R"(
Check whether this dimension is capable of being merged
Expand All @@ -128,7 +128,7 @@ void regclass_pyngraph_Dimension(py::module m) {
:rtype: bool
)");
dim.def("relaxes",
&ngraph::Dimension::relaxes,
&ov::Dimension::relaxes,
py::arg("d"),
R"(
Check whether this dimension is a relaxation of the argument.
Expand All @@ -145,7 +145,7 @@ void regclass_pyngraph_Dimension(py::module m) {
:rtype: bool
)");
dim.def("refines",
&ngraph::Dimension::refines,
&ov::Dimension::refines,
py::arg("d"),
R"(
Check whether this dimension is a refinement of the argument.
Expand All @@ -162,13 +162,13 @@ void regclass_pyngraph_Dimension(py::module m) {
:rtype: bool
)");

dim.def("__str__", [](const ngraph::Dimension& self) -> std::string {
dim.def("__str__", [](const ov::Dimension& self) -> std::string {
std::stringstream ss;
ss << self;
return ss.str();
});

dim.def("__repr__", [](const ngraph::Dimension& self) -> std::string {
dim.def("__repr__", [](const ov::Dimension& self) -> std::string {
return "<Dimension: " + py::cast(self).attr("__str__")().cast<std::string>() + ">";
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
#include <pybind11/stl.h>
#include <pybind11/stl_bind.h>

#include "ngraph/type.hpp"
#include "openvino/core/type.hpp"

namespace py = pybind11;

void regclass_pyngraph_DiscreteTypeInfo(py::module m) {
py::class_<ngraph::DiscreteTypeInfo, std::shared_ptr<ngraph::DiscreteTypeInfo>> discrete_type_info(
m,
"DiscreteTypeInfo",
py::module_local());
discrete_type_info.doc() = "ngraph.impl.DiscreteTypeInfo wraps ngraph::DiscreteTypeInfo";
py::class_<ov::DiscreteTypeInfo, std::shared_ptr<ov::DiscreteTypeInfo>> discrete_type_info(m,
"DiscreteTypeInfo",
py::module_local());
discrete_type_info.doc() = "ngraph.impl.DiscreteTypeInfo wraps ov::DiscreteTypeInfo";

// operator overloading
discrete_type_info.def(py::self < py::self);
Expand All @@ -27,11 +26,11 @@ void regclass_pyngraph_DiscreteTypeInfo(py::module m) {
discrete_type_info.def(py::self == py::self);
discrete_type_info.def(py::self != py::self);

discrete_type_info.def_readonly("name", &ngraph::DiscreteTypeInfo::name);
discrete_type_info.def_readonly("version_id", &ngraph::DiscreteTypeInfo::version_id);
discrete_type_info.def_readonly("parent", &ngraph::DiscreteTypeInfo::parent);
discrete_type_info.def_readonly("name", &ov::DiscreteTypeInfo::name);
discrete_type_info.def_readonly("version_id", &ov::DiscreteTypeInfo::version_id);
discrete_type_info.def_readonly("parent", &ov::DiscreteTypeInfo::parent);

discrete_type_info.def("__repr__", [](const ngraph::DiscreteTypeInfo& self) {
discrete_type_info.def("__repr__", [](const ov::DiscreteTypeInfo& self) {
std::string name = std::string(self.name);
std::string version = std::string(self.version_id);
if (self.parent != nullptr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "dict_attribute_visitor.hpp"
#include "ngraph/check.hpp"
#include "ngraph/except.hpp"
#include "ngraph/log.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/util/op_types.hpp"
#include "ngraph/op/util/variable.hpp"
Expand Down Expand Up @@ -61,8 +60,6 @@ class NodeFactory {
"Currently NodeFactory doesn't support Constant node: ",
op_type_name);

NGRAPH_WARN << "Empty op created! Please assign inputs and attributes and run validate() before op is used.";

return op_node;
}

Expand Down
14 changes: 7 additions & 7 deletions src/bindings/python/src/compatibility/pyngraph/partial_shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <sstream>
#include <string>

#include "ngraph/dimension.hpp" // ngraph::Dimension
#include "ngraph/shape.hpp" // ngraph::Shape
#include "ngraph/shape.hpp" // ngraph::Shape
#include "openvino/core/dimension.hpp" // ov::Dimension
#include "pyngraph/partial_shape.hpp"

namespace py = pybind11;
Expand All @@ -26,16 +26,16 @@ void regclass_pyngraph_PartialShape(py::module m) {
shape.doc() = "ngraph.impl.PartialShape wraps ngraph::PartialShape";

shape.def(py::init([](const std::vector<int64_t>& dimensions) {
return ngraph::PartialShape(std::vector<ngraph::Dimension>(dimensions.begin(), dimensions.end()));
return ngraph::PartialShape(std::vector<ov::Dimension>(dimensions.begin(), dimensions.end()));
}));
shape.def(py::init<const std::initializer_list<size_t>&>());
shape.def(py::init<const std::vector<size_t>&>());
shape.def(py::init<const std::initializer_list<ngraph::Dimension>&>());
shape.def(py::init<const std::vector<ngraph::Dimension>&>());
shape.def(py::init<const std::initializer_list<ov::Dimension>&>());
shape.def(py::init<const std::vector<ov::Dimension>&>());
shape.def(py::init<const ngraph::Shape&>());
shape.def(py::init<const ngraph::PartialShape&>());

shape.def_static("dynamic", &ngraph::PartialShape::dynamic, py::arg("r") = ngraph::Dimension());
shape.def_static("dynamic", &ngraph::PartialShape::dynamic, py::arg("r") = ov::Dimension());

shape.def_property_readonly("is_dynamic",
&ngraph::PartialShape::is_dynamic,
Expand Down Expand Up @@ -163,7 +163,7 @@ void regclass_pyngraph_PartialShape(py::module m) {
)");
shape.def(
"get_dimension",
[](const ngraph::PartialShape& self, size_t index) -> ngraph::Dimension {
[](const ngraph::PartialShape& self, size_t index) -> ov::Dimension {
return self[index];
},
py::arg("index"),
Expand Down
1 change: 0 additions & 1 deletion src/core/include/ngraph/attribute_adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <vector>

#include "ngraph/enum_names.hpp"
#include "ngraph/type.hpp"
#include "openvino/core/attribute_adapter.hpp"

///
Expand Down
1 change: 0 additions & 1 deletion src/core/include/ngraph/attribute_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <utility>

#include "ngraph/partial_shape.hpp"
#include "ngraph/type.hpp"
#include "ngraph/type/element_type.hpp"
#include "openvino/core/attribute_visitor.hpp"

Expand Down
28 changes: 0 additions & 28 deletions src/core/include/ngraph/coordinate.hpp

This file was deleted.

23 changes: 0 additions & 23 deletions src/core/include/ngraph/dimension.hpp

This file was deleted.

1 change: 0 additions & 1 deletion src/core/include/ngraph/distributed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "ngraph/attribute_visitor.hpp"
#include "ngraph/deprecated.hpp"
#include "ngraph/type.hpp"
#include "ngraph/type/element_type.hpp"

namespace ngraph {
Expand Down
Loading

0 comments on commit 7e745c2

Please sign in to comment.