[nGraph] Matching names of functions (#1524)
authorJan Iwaszkiewicz <jan.iwaszkiewicz@intel.com>
Thu, 30 Jul 2020 11:25:42 +0000 (13:25 +0200)
committerGitHub <noreply@github.com>
Thu, 30 Jul 2020 11:25:42 +0000 (13:25 +0200)
ngraph/python/src/pyngraph/function.cpp
ngraph/python/src/pyngraph/node.cpp
ngraph/python/src/pyngraph/ops/util/arithmetic_reduction.cpp
ngraph/python/src/pyngraph/ops/util/index_reduction.cpp
ngraph/python/tests/test_ngraph/test_basic.py

index 9e37bfc..5248c25 100644 (file)
@@ -45,8 +45,8 @@ void regclass_pyngraph_Function(py::module m)
     function.def("get_parameters", &ngraph::Function::get_parameters);
     function.def("get_results", &ngraph::Function::get_results);
     function.def("get_result", &ngraph::Function::get_result);
-    function.def("get_unique_name", &ngraph::Function::get_name);
-    function.def("get_name", &ngraph::Function::get_friendly_name);
+    function.def("get_name", &ngraph::Function::get_name);
+    function.def("get_friendly_name", &ngraph::Function::get_friendly_name);
     function.def("set_friendly_name", &ngraph::Function::set_friendly_name);
     function.def("is_dynamic", &ngraph::Function::is_dynamic);
     function.def("__repr__", [](const ngraph::Function& self) {
@@ -99,4 +99,9 @@ void regclass_pyngraph_Function(py::module m)
 
         return pybind_capsule;
     });
+
+    function.def_property_readonly("name", &ngraph::Function::get_name);
+    function.def_property("friendly_name",
+                          &ngraph::Function::get_friendly_name,
+                          &ngraph::Function::set_friendly_name);
 }
index 1b8bc0f..dcaa80b 100644 (file)
@@ -76,7 +76,7 @@ void regclass_pyngraph_Node(py::module m)
     node.def("get_output_shape", &ngraph::Node::get_output_shape);
     node.def("get_output_partial_shape", &ngraph::Node::get_output_partial_shape);
     node.def("get_type_name", &ngraph::Node::get_type_name);
-    node.def("get_unique_name", &ngraph::Node::get_name);
+    node.def("get_name", &ngraph::Node::get_name);
     node.def("get_friendly_name", &ngraph::Node::get_friendly_name);
     node.def("set_friendly_name", &ngraph::Node::set_friendly_name);
     node.def("input", (ngraph::Input<ngraph::Node>(ngraph::Node::*)(size_t)) & ngraph::Node::input);
index 8c40d1e..df67fe4 100644 (file)
@@ -31,6 +31,12 @@ void regclass_pyngraph_op_util_ArithmeticReduction(py::module m)
     // arithmeticReduction.def(py::init<const std::string&,
     //                                  const std::shared_ptr<ngraph::Node>&,
     //                                  const ngraph::AxisSet& >());
-    arithmeticReduction.def_property_readonly(
-        "reduction_axes", &ngraph::op::util::ArithmeticReduction::get_reduction_axes);
+    arithmeticReduction.def("get_reduction_axes",
+                            &ngraph::op::util::ArithmeticReduction::get_reduction_axes);
+    arithmeticReduction.def("set_reduction_axes",
+                            &ngraph::op::util::ArithmeticReduction::set_reduction_axes);
+
+    arithmeticReduction.def_property("reduction_axes",
+                                     &ngraph::op::util::ArithmeticReduction::get_reduction_axes,
+                                     &ngraph::op::util::ArithmeticReduction::set_reduction_axes);
 }
index fbfc51c..5093b2c 100644 (file)
@@ -27,8 +27,18 @@ void regclass_pyngraph_op_util_IndexReduction(py::module m)
 {
     py::class_<ngraph::op::util::IndexReduction, std::shared_ptr<ngraph::op::util::IndexReduction>>
         indexReduction(m, "IndexRedection");
-    indexReduction.def_property_readonly("reduction_axis",
-                                         &ngraph::op::util::IndexReduction::get_reduction_axis);
-    indexReduction.def_property_readonly("index_element_type",
-                                         &ngraph::op::util::IndexReduction::get_index_element_type);
+
+    indexReduction.def("get_reduction_axis", &ngraph::op::util::IndexReduction::get_reduction_axis);
+    indexReduction.def("set_reduction_axis", &ngraph::op::util::IndexReduction::set_reduction_axis);
+    indexReduction.def("get_index_element_type",
+                       &ngraph::op::util::IndexReduction::get_index_element_type);
+    indexReduction.def("set_index_element_type",
+                       &ngraph::op::util::IndexReduction::set_index_element_type);
+
+    indexReduction.def_property("reduction_axis",
+                                &ngraph::op::util::IndexReduction::get_reduction_axis,
+                                &ngraph::op::util::IndexReduction::set_reduction_axis);
+    indexReduction.def_property("index_element_type",
+                                &ngraph::op::util::IndexReduction::get_index_element_type,
+                                &ngraph::op::util::IndexReduction::set_index_element_type);
 }
index 3369057..c25635f 100644 (file)
@@ -43,7 +43,7 @@ def test_ngraph_function_api():
     assert list(function.get_output_shape(0)) == [2, 2]
     assert len(function.get_parameters()) == 3
     assert len(function.get_results()) == 1
-    assert function.get_name() == "TestFunction"
+    assert function.get_friendly_name() == "TestFunction"
 
 
 @pytest.mark.parametrize(