Skip to content
Snippets Groups Projects
Commit 5b97a6a5 authored by Maxence Naud's avatar Maxence Naud
Browse files

[Upd] replace() python binding

parent 7299fadf
No related branches found
No related tags found
1 merge request!45[Upd] replace() instead of replaceWith() in GraphView
Pipeline #33928 failed
......@@ -26,7 +26,7 @@ void init_GraphView(py::module& m) {
.def("save", &GraphView::save, py::arg("path"), py::arg("verbose") = false,
R"mydelimiter(
Save the GraphView as a Mermaid graph in a .md file at the specified location.
:param path: save location
:type path: str
)mydelimiter")
......@@ -34,14 +34,14 @@ void init_GraphView(py::module& m) {
.def("get_output_nodes", &GraphView::outputNodes,
R"mydelimiter(
Get set of output Nodes.
:rtype: list[Node]
)mydelimiter")
.def("get_input_nodes", &GraphView::inputNodes,
R"mydelimiter(
Get set of input Nodes.
:rtype: list[Node]
)mydelimiter")
......@@ -49,7 +49,7 @@ void init_GraphView(py::module& m) {
py::arg("other_node"), py::arg("include_learnable_parameters") = true,
R"mydelimiter(
Include a Node to the current GraphView object.
:param other_node: Node to add
:type oth_Node: Node
:param includeLearnableParameter: include non-data inputs, like weights and biases. Default True.
......@@ -66,18 +66,20 @@ void init_GraphView(py::module& m) {
py::arg("fromTensor") = 0U, py::arg("toTensor") = gk_IODefaultIndex,
R"mydelimiter(
Include a Node to the current GraphView object.
:param other_node: Node to add
:type oth_Node: Node
:param includeLearnableParameter: include non-data inputs, like weights and biases. Default True.
:type includeLearnableParameter
)mydelimiter")
.def("replace_with", &GraphView::replaceWith, py::arg("new_nodes"),
.def_static("replace", &GraphView::replace, py::args("old_nodes"), py::arg("new_nodes"),
R"mydelimiter(
Replace the current GraphView with the set of given Nodes if possible.
:param new_nodes: Nodes with connections already taken care of.
Replace the old set of Nodes with the new set of given Nodes if possible in every GraphView.
:param old_nodes: Nodes actually connected in GraphViews.
:type old_nodes: Node
:param new_nodes: Nodes with inner connections already taken care of.
:type new_nodes: Node
:return: Whether any replacement has been made.
:rtype: bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment