Skip to content
Snippets Groups Projects

#194: Add documentation for GraphView

Closed Ghost User requested to merge hrouis/aidge_core:aidge_core#194 into dev
1 file
+ 15
8
Compare changes
  • Side-by-side
  • Inline
@@ -445,16 +445,14 @@ public:
@@ -445,16 +445,14 @@ public:
bool includeLearnableParam = true);
bool includeLearnableParam = true);
/**
/**
//@todo here i am
* @brief Include a Node in the current GraphView and link it to another
* @brief Include a Node in the current GraphView and link it to another
* already contained Node.
* already contained Node as its child.
*
*
* @param toOtherNode Pointer to the Node to add.
* @param toOtherNode Pointer to the Node to add.
* @param fromOutNode Pointer to the already included Node the new Node will
* @param fromOutNode Pointer to the already included Node the new Node will
* be linked to (it will become a parent of the new Node). If the GraphView
* be linked to (it will become a parent of the new Node). If the GraphView
* only has one output Node, then default to this Node.
* only has one output Node, then default to this Node.
* @param fromTensor Ouput Tensor ID of the already included Node. Default to
* @param fromTensor Ouput Tensor ID of the already included Node. Default to 0.
* 0.
* @param toTensor Input Tensor ID of the new Node. Default to gk_IODefaultIndex, meaning
* @param toTensor Input Tensor ID of the new Node. Default to gk_IODefaultIndex, meaning
* first available data input for the Node.
* first available data input for the Node.
*/
*/
@@ -464,15 +462,14 @@ public:
@@ -464,15 +462,14 @@ public:
/**
/**
* @brief Include a Node in the current GraphView and link it to another
* @brief Include a Node in the current GraphView and link it to another
* already contained Node.
* already contained Node as its child.
*
*
* @param toOtherNode Pointer to the Node to add.
* @param toOtherNode Pointer to the Node to add.
* @param fromOutNodeName Name of the already included Node the new Node will
* @param fromOutNodeName Name of the already included Node the new Node will
* be linked to (it will become a parent of the new Node). As a name is
* be linked to (it will become a parent of the new Node). As a name is
* optional, ensure such Node is in the GraphView or it will send back an
* optional, ensure such Node is in the GraphView or it will send back an
* error message.
* error message.
* @param fromTensor Ouput Tensor ID of the already included Node. Default to
* @param fromTensor Ouput Tensor ID of the already included Node. Default to 0.
* 0.
* @param toTensor Input Tensor ID of the new Node. Default to gk_IODefaultIndex, meaning
* @param toTensor Input Tensor ID of the new Node. Default to gk_IODefaultIndex, meaning
* first available data input for the Node.
* first available data input for the Node.
*/
*/
@@ -483,6 +480,10 @@ public:
@@ -483,6 +480,10 @@ public:
addChild(toOtherNode, mNodeRegistry.at(fromOutNodeName), fromTensor, toTensor);
addChild(toOtherNode, mNodeRegistry.at(fromOutNodeName), fromTensor, toTensor);
}
}
 
/**
 
//todo only updates registery with pair (newName, node) but does not ensure node's name is indeed newName
 
* @brief
 
*/
inline void updateNodeName(const std::shared_ptr<Node>& node, const std::string& newName){
inline void updateNodeName(const std::shared_ptr<Node>& node, const std::string& newName){
if (!newName.empty()) {
if (!newName.empty()) {
auto itNew = mNodeRegistry.insert(std::make_pair(newName, node));
auto itNew = mNodeRegistry.insert(std::make_pair(newName, node));
@@ -518,6 +519,7 @@ public:
@@ -518,6 +519,7 @@ public:
std::pair<NodePtr, IOIndex_t>(nullptr, gk_IODefaultIndex));
std::pair<NodePtr, IOIndex_t>(nullptr, gk_IODefaultIndex));
/**
/**
 
//@todo not implemented
* @brief Swap two Node instances if possible.
* @brief Swap two Node instances if possible.
* @param node
* @param node
* @param otherNode
* @param otherNode
@@ -526,10 +528,13 @@ public:
@@ -526,10 +528,13 @@ public:
*/
*/
bool swap(Node &node, Node &otherNode);
bool swap(Node &node, Node &otherNode);
 
//@todo not implemented
void link(const std::string& name1_inID, const std::string& name2_outID);
void link(const std::string& name1_inID, const std::string& name2_outID);
/**
/**
* @brief Insert a node (newParentNode) as a parent of the passed node (childNode).
//@todo why some functions have separate inputs for Node and TensorID (such as here) while other put them in a pair (consistency would be nice)
 
* @brief Insert a node (newParentNode) as a parent of the passed node (childNode)
 
* and as a child of the current parent of the Node.
*
*
* @param childNode Node that gets a new parent.
* @param childNode Node that gets a new parent.
* @param newParentNode Inserted Node.
* @param newParentNode Inserted Node.
@@ -544,6 +549,7 @@ public:
@@ -544,6 +549,7 @@ public:
IOIndex_t newParentOutputTensorIdx);
IOIndex_t newParentOutputTensorIdx);
/**
/**
 
//@todo seems messed up, imma skip it for now
* @brief Replace a set of Nodes in every available GraphView with a new set of Nodes if possible.
* @brief Replace a set of Nodes in every available GraphView with a new set of Nodes if possible.
* Both sets should include all the necessary Producers.
* Both sets should include all the necessary Producers.
* @details There are 3 cases of replacement:
* @details There are 3 cases of replacement:
@@ -569,6 +575,7 @@ public:
@@ -569,6 +575,7 @@ public:
* @brief Clone the GraphView with shared Operators. It is a new GraphView, with cloned Nodes, but the new Nodes refer to the same Operators as the original ones.
* @brief Clone the GraphView with shared Operators. It is a new GraphView, with cloned Nodes, but the new Nodes refer to the same Operators as the original ones.
* @return std::shared_ptr<GraphView>
* @return std::shared_ptr<GraphView>
*/
*/
 
//@todo here i am
inline std::shared_ptr<GraphView> cloneSharedOperators() const {
inline std::shared_ptr<GraphView> cloneSharedOperators() const {
return cloneCallback(&Node::cloneSharedOperators);
return cloneCallback(&Node::cloneSharedOperators);
}
}
Loading