Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
aidge
aidge_core
Commits
32bdd104
Commit
32bdd104
authored
5 months ago
by
Octave Perrin
Browse files
Options
Downloads
Patches
Plain Diff
python binds
parent
95d10e63
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/aidge/graph/GraphView.hpp
+2
-2
2 additions, 2 deletions
include/aidge/graph/GraphView.hpp
python_binding/graph/pybind_GraphView.cpp
+43
-5
43 additions, 5 deletions
python_binding/graph/pybind_GraphView.cpp
with
45 additions
and
7 deletions
include/aidge/graph/GraphView.hpp
+
2
−
2
View file @
32bdd104
...
@@ -190,7 +190,7 @@ public:
...
@@ -190,7 +190,7 @@ public:
/**
/**
* @brief Orders the inputs of the GraphView
* @brief Orders the inputs of the GraphView
* @details The
I
nputs will be ordered in the same order as they come in the std::vector.
* @details The
i
nputs will be ordered in the same order as they come in the std::vector.
* Inputs missing from this vector will then be added as per their previous order.
* Inputs missing from this vector will then be added as per their previous order.
* @param std::vector<std::pair<NodePtr, IOIndex_t>>& inputs set of inputs in the wanted order
* @param std::vector<std::pair<NodePtr, IOIndex_t>>& inputs set of inputs in the wanted order
*/
*/
...
@@ -362,7 +362,7 @@ public:
...
@@ -362,7 +362,7 @@ public:
const
NodePtr
otherNode
)
const
;
// TODO change it for a vector<vector> ?
const
NodePtr
otherNode
)
const
;
// TODO change it for a vector<vector> ?
/**
/**
* @brief Get the Nodes
pointed to by
the GraphView
object
.
* @brief Get the Nodes
in
the GraphView.
* @return std::set<NodePtr>
* @return std::set<NodePtr>
*/
*/
inline
const
std
::
set
<
NodePtr
>&
getNodes
()
const
noexcept
{
return
mNodes
;
}
inline
const
std
::
set
<
NodePtr
>&
getNodes
()
const
noexcept
{
return
mNodes
;
}
...
...
This diff is collapsed.
Click to expand it.
python_binding/graph/pybind_GraphView.cpp
+
43
−
5
View file @
32bdd104
...
@@ -55,8 +55,23 @@ void init_GraphView(py::module& m) {
...
@@ -55,8 +55,23 @@ void init_GraphView(py::module& m) {
:rtype: list[Node]
:rtype: list[Node]
)mydelimiter"
)
)mydelimiter"
)
.
def
(
"set_ordered_inputs"
,
&
GraphView
::
setOrderedInputs
,
py
::
arg
(
"inputs"
))
.
def
(
"set_ordered_inputs"
,
&
GraphView
::
setOrderedInputs
,
py
::
arg
(
"inputs"
),
.
def
(
"set_ordered_outputs"
,
&
GraphView
::
setOrderedOutputs
,
py
::
arg
(
"outputs"
))
R"mydelimiter(
Orders the inputs of the GraphView
The inputs will be ordered in the same order as they come in the std::vector.
Inputs missing from this vector will then be added as per their previous order.
:param inputs: set of inputs in the wanted order
:type inputs: List[(Node, int)]
)mydelimiter"
)
.
def
(
"set_ordered_outputs"
,
&
GraphView
::
setOrderedOutputs
,
py
::
arg
(
"outputs"
),
R"mydelimiter(
Orders the outputs of the GraphView
The outputs will be ordered in the same order as they come in the std::vector.
Outputs missing from this vector will then be added as per their previous order.
:param outputs: set of outputs in the wanted order
:type outputs: List[(Node, int)]
)mydelimiter"
)
.
def
(
"add"
,
(
void
(
GraphView
::*
)(
std
::
shared_ptr
<
Node
>
,
bool
))
&
GraphView
::
add
,
.
def
(
"add"
,
(
void
(
GraphView
::*
)(
std
::
shared_ptr
<
Node
>
,
bool
))
&
GraphView
::
add
,
py
::
arg
(
"other_node"
),
py
::
arg
(
"include_learnable_parameters"
)
=
true
,
py
::
arg
(
"other_node"
),
py
::
arg
(
"include_learnable_parameters"
)
=
true
,
...
@@ -124,9 +139,32 @@ void init_GraphView(py::module& m) {
...
@@ -124,9 +139,32 @@ void init_GraphView(py::module& m) {
:return: Whether any replacement has been made.
:return: Whether any replacement has been made.
:rtype: bool
:rtype: bool
)mydelimiter"
)
)mydelimiter"
)
.
def
(
"clone"
,
&
GraphView
::
clone
)
.
def
(
"clone"
,
&
GraphView
::
clone
,
.
def
(
"get_nodes"
,
&
GraphView
::
getNodes
)
R"mydelimiter(
.
def
(
"get_node"
,
&
GraphView
::
getNode
,
py
::
arg
(
"node_name"
))
Clone the current GraphView using a callback function for the Node cloning, allowing to specify how each
Node should be cloned or replaced by another Node type, or removed (i.e. replaced by identity).
When a Node is removed, the clone() method automatically finds the next valid parent in line, going backward in
the graph and connects it if that makes sense without ambiguity (effectively treating the removed Node as an
identity operation).
:param: cloneNode Callback function to clone a node
:type: cloneNode Node
:return: Cloned GraphView
:rtype: GraphView
)mydelimiter"
)
.
def
(
"get_nodes"
,
&
GraphView
::
getNodes
,
R"mydelimiter(
Get the Nodes in the GraphView.
:return: List of the GraphView's Nodes
:rtype: List[Node]
)mydelimiter"
)
.
def
(
"get_node"
,
&
GraphView
::
getNode
,
py
::
arg
(
"node_name"
),
R"mydelimiter(
Get the Node with the corresponding name if it is in the GraphView.
:param: node_name The name of the Node
:type: string
:return: The Node of the GraphView with corresponding name
:rtype: Node
)mydelimiter"
)
.
def
(
"forward_dims"
,
&
GraphView
::
forwardDims
,
py
::
arg
(
"dims"
)
=
std
::
vector
<
std
::
vector
<
DimSize_t
>>
(),
py
::
arg
(
"allow_data_dependency"
)
=
false
)
.
def
(
"forward_dims"
,
&
GraphView
::
forwardDims
,
py
::
arg
(
"dims"
)
=
std
::
vector
<
std
::
vector
<
DimSize_t
>>
(),
py
::
arg
(
"allow_data_dependency"
)
=
false
)
.
def
(
"compile"
,
&
GraphView
::
compile
,
py
::
arg
(
"backend"
),
py
::
arg
(
"datatype"
),
py
::
arg
(
"device"
)
=
0
,
py
::
arg
(
"dims"
)
=
std
::
vector
<
std
::
vector
<
DimSize_t
>>
())
.
def
(
"compile"
,
&
GraphView
::
compile
,
py
::
arg
(
"backend"
),
py
::
arg
(
"datatype"
),
py
::
arg
(
"device"
)
=
0
,
py
::
arg
(
"dims"
)
=
std
::
vector
<
std
::
vector
<
DimSize_t
>>
())
.
def
(
"__call__"
,
&
GraphView
::
operator
(),
py
::
arg
(
"connectors"
))
.
def
(
"__call__"
,
&
GraphView
::
operator
(),
py
::
arg
(
"connectors"
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment