void addLossToSorted();
/**
+ * @brief getter of graph input nodes with index number
+ * @param idx
+ * @return graph node of input node
+ */
+ const std::shared_ptr<GraphNode> &getInputNode(unsigned int idx) const {
+ return input_list[idx];
+ }
+
+ /**
+ * @brief getter of number of input nodes
+ * @return number of input nodes
+ */
+ unsigned int getNumInputNodes() const { return input_list.size(); }
+
+ /**
+ * @brief getter of graph output nodes with index number
+ * @param idx
+ * @return graph node of output node
+ */
+ const std::shared_ptr<GraphNode> &getOutputNode(unsigned int idx) const {
+ return output_list[idx];
+ }
+
+ /**
+ * @brief getter of number of output nodes
+ * @return number of output nodes
+ */
+ unsigned int getNumOutputNodes() const { return output_list.size(); }
+
+ /**
* @brief Verify if the node exists
*/
inline bool verifyNode(const std::string &name) {
}
private:
+ std::vector<std::shared_ptr<GraphNode>> input_list;
+ std::vector<std::shared_ptr<GraphNode>> output_list;
std::vector<std::shared_ptr<GraphNode>>
node_list; /**< Unordered Node List */
std::vector<std::shared_ptr<GraphNode>> Sorted; /**< Ordered Node List */
in_node->setProperty({"activation=none"});
lnode->setInputLayers({in_node->getName()});
- /** output layers for layer aobj will be set in setOutputLayers() */
+ /** output layers for layer obj will be set in setOutputLayers() */
updateConnectionName(in_node->getName(), lnode->getName());
graph.addNode(lnode, false);
void NetworkGraph::setOutputLayers() {
- size_t last_layer_count = 0;
for (auto iter_idx = cbegin(); iter_idx != cend(); iter_idx++) {
auto &layer_idx = *iter_idx;
for (auto iter_i = cbegin(); iter_i != cend(); iter_i++) {
}
}
}
-
- if (layer_idx->getNumOutputConnections() == 0) {
- last_layer_count += 1;
- }
- }
-
- if (last_layer_count != 1) {
- throw std::invalid_argument(
- "Error: Multiple last layers in the model not supported");
}
}
}
}
/// @todo add check that input_layers <-> output_layers does match.
+ /// @todo check whether graph has a cycle or graph is seperated to subgraph
return status;
}