return false;
};
- auto make_subgraph = [&](const model::OperationIndex &node_index, const model::Operation &node,
- model::Layout layout) {
- auto subg_index = _subgraphs->emplace(node_index, node, layout);
- auto &subg = _subgraphs->at(subg_index);
- subg.setOutputs(node.getOutputs());
- subg.setInputs(node.getInputs());
- return subg_index;
+ // Create a fresh subgraph with one operation, and append it to subgraphs
+ auto append_fresh_single_op_subgraph = [&](const model::OperationIndex &node_index,
+ const model::Operation &node, model::Layout layout) {
+ // Create a fresh subgraph
+ auto subg = nnfw::cpp14::make_unique<model::Subgraph>(layout);
+
+ // Add an operation
+ subg->appendOperation(node_index, node);
+
+ // Update input/output
+ subg->setOutputs(node.getOutputs());
+ subg->setInputs(node.getInputs());
+
+ return _subgraphs->emplace(std::move(subg));
};
model::Subgraph *subg = nullptr;
if (!subg || is_profiling || !mergeable(subg_index, node_index))
{
// TODO Determines how to set the layout of the subgraph
- auto new_subg_index = make_subgraph(node_index, node, layout);
+ auto new_subg_index = append_fresh_single_op_subgraph(node_index, node, layout);
// Subgraph LowerInfo
setLowerInfo(new_subg_index,