diff --git a/include/aidge/graph/Node.hpp b/include/aidge/graph/Node.hpp index 5ae4eb5d893244fa842e6bb0435c0a8ab3bc0ac5..de2a7b6aae5357d9a1304ec2b718a475abc1ea43 100644 --- a/include/aidge/graph/Node.hpp +++ b/include/aidge/graph/Node.hpp @@ -140,7 +140,7 @@ public: /** * @brief List of pair <Parent, ID of the data intput>. When an input is not - * linked to any Parent, the pair is <nullptr, gk_IODefaultIndex>. + * linked to any Parent, the pair is <nullptr, gk_IODefaultIndex>. * Data inputs exclude inputs expecting parameters (weights or bias). * @return std::vector<std::pair<std::shared_ptr<Node>, IOIndex_t>> */ diff --git a/python_binding/graph/pybind_Node.cpp b/python_binding/graph/pybind_Node.cpp index 1f655b50a38dddf597f51879411535ff655ed694..c4525dce89cbe125b841447a99eddd4214017883 100644 --- a/python_binding/graph/pybind_Node.cpp +++ b/python_binding/graph/pybind_Node.cpp @@ -63,12 +63,19 @@ void init_Node(py::module& m) { )mydelimiter") .def("add_child", - (void (Node::*)(std::shared_ptr<GraphView>, const IOIndex_t, - std::pair<std::shared_ptr<Node>, IOIndex_t>)) & - Node::addChild, + [](Node &self, std::shared_ptr<GraphView> other_graph, const IOIndex_t out_id=0, + py::object other_in_id = py::none()) { + std::pair<NodePtr, IOIndex_t> cpp_other_in_id; + // Note: default arg nullptr to allow python binding + if (other_in_id.is_none()) { + cpp_other_in_id = std::pair<NodePtr, IOIndex_t>(nullptr, gk_IODefaultIndex); + }else{ + cpp_other_in_id = other_in_id.cast<std::pair<NodePtr, IOIndex_t>>(); + } + self.addChild(other_graph, out_id, cpp_other_in_id); + }, py::arg("other_graph"), py::arg("out_id") = 0, - py::arg("other_in_id") = - std::pair<std::shared_ptr<Node>, IOIndex_t>(nullptr, gk_IODefaultIndex), + py::arg("other_in_id") = py::none(), R"mydelimiter( Link a Node from a specific GraphView to the current Node.