From 397a6f8b6c397bfe74fa3fd56243b65c4068174a Mon Sep 17 00:00:00 2001 From: Octave Perrin <operrin@lrtechnologies.fr> Date: Thu, 21 Nov 2024 15:36:29 +0100 Subject: [PATCH] more pybind --- include/aidge/graph/GraphView.hpp | 2 +- python_binding/graph/pybind_GraphView.cpp | 34 +++++++++++++---------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/include/aidge/graph/GraphView.hpp b/include/aidge/graph/GraphView.hpp index b98123fd4..921957e29 100644 --- a/include/aidge/graph/GraphView.hpp +++ b/include/aidge/graph/GraphView.hpp @@ -416,7 +416,7 @@ public: * Get the nodes name according to the GraphView nodes ranking. * @param format The formatting string to be used with fmt::format(). * @details The usable positional arguments are the following: - * {0} node name, {1} node type, {2} rank, {3} type rank + * {0} node name, {1} node type, {2} rank, {3} type rankf * @param markNonUnicity If true, non unique ranking is prefixed with "?" * @return std::map<NodePtr, std::string> A map with the corresponding names */ diff --git a/python_binding/graph/pybind_GraphView.cpp b/python_binding/graph/pybind_GraphView.cpp index 289b7bf71..cb4142aa7 100644 --- a/python_binding/graph/pybind_GraphView.cpp +++ b/python_binding/graph/pybind_GraphView.cpp @@ -180,7 +180,15 @@ void init_GraphView(py::module& m) { .def("set_backend", &GraphView::setBackend, py::arg("backend"), py::arg("device") = 0) .def("get_ordered_nodes", &GraphView::getOrderedNodes, py::arg("reversed") = false, R"mydelimiter( - Get ordered nodes for the graph view + Get a topological node order for an acyclic walk of the graph. + Graph cycles are broken on operator back edges such that resolution on + single level lattice can be done in a single pass as it is + the case generally for static resolution of Tensor shapes/datatypes. + + :param reversed: if True, returns a topological order of the reversed graph + :type reversed: bool + :return: the ordered list of nodes + :rtype: List[Node] )mydelimiter") // .def("__getitem__", [](Tensor& b, size_t idx)-> py::object { // // TODO : Should return error if backend not compatible with get @@ -218,20 +226,18 @@ void init_GraphView(py::module& m) { .def("get_ranked_nodes_name", &GraphView::getRankedNodesName, py::arg("format"), py::arg("mark_non_unicity") = true, R"mydelimiter( - -//TODO - Get the nodes name according to the GraphView nodes ranking. - @param format The formatting string to be used with fmt::format(). - @details The usable positional arguments are the following: - {0} node name, {1} node type, {2} rank, {3} type rank - @param markNonUnicity If true, non unique ranking is prefixed with "?" - @return std::map<NodePtr, std::string> A map with the corresponding names - */ - + Get the nodes name according to the GraphView nodes ranking. + + :param format: The formatting string to be used in the output f-string + The usable positional arguments are the following: + {0} node name, {1} node type, {2} rank, {3} type rank + :type format: string + :param markNonUnicity: If true, non unique ranking is prefixed with "?" + :type markNonUnicity: bool + :return: map(Node, string) A map with the corresponding names )mydelimiter") - - .def("set_dataformat", &GraphView::setDataFormat, py::arg("dataformat")) - ; + + .def("set_dataformat", &GraphView::setDataFormat, py::arg("dataformat")); m.def("get_connected_graph_view", &getConnectedGraphView, R"mydelimiter( -- GitLab