Skip to content

Commit

Permalink
fix: 改正链式图转连续图
Browse files Browse the repository at this point in the history
Signed-off-by: YdrMaster <[email protected]>
  • Loading branch information
YdrMaster committed Oct 17, 2023
1 parent 9e3f307 commit 6dd0d69
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/01graph_topo/include/graph_topo/linked_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ namespace refactor::graph_topo {
while (mappedNodes.size() < _nodes.size()) {
auto before = mappedNodes.size();
for (auto &n : _nodes) {
if (mappedNodes.find(n.get()) != mappedNodes.end()) { continue; }
// ∃e ∈ n.inputs, e.source ∉ mapped
if (std::any_of(n->_inputs.begin(), n->_inputs.end(),
[&mappedNodes](auto const &e) {
Expand Down
10 changes: 2 additions & 8 deletions src/05computation/src/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ namespace refactor::computation {
auto newNode = g_.pushNode(std::move(transpose), {g_.shareEdge(insertEdge)});
newNode->connect(0, g_.nodes()[nodeIdx]->inputs()[i]);
g_.nodes()[nodeIdx]->connect(i, newNode->outputs()[0]);
fmt::println("============================1");
fmt::println("{}", g_.toString());
} else {
continue;
}
Expand All @@ -188,8 +186,6 @@ namespace refactor::computation {
auto newNode = g_.pushNode(std::move(transpose), {g_.shareEdge(insertEdge)});
newNode->connect(0, g_.nodes()[nodeIdx]->outputs()[i]);
g_.replaceOutput(outputs[i], std::make_shared<refactor::graph_topo::LinkedGraph<Node, Edge>::Edge>(insertEdge));
fmt::println("============================2");
fmt::println("{}", g_.toString());
continue;
}
for (auto node : outputs[i]->targets()) {
Expand All @@ -206,14 +202,12 @@ namespace refactor::computation {
newNode->connect(0, g_.nodes()[nodeIdx]->outputs()[i]);
auto it = std::find(node.first->inputs().begin(), node.first->inputs().end(), outputs[i]);
node.first->connect(it - node.first->inputs().begin(), newNode->outputs()[0]);
fmt::println("============================3");
fmt::println("{}", g_.toString());
}
}
}
}
}
this->_internal = g_.intoGraph();
_internal = g_.intoGraph();
fmt::println("Transposed finished");
}

Expand Down Expand Up @@ -253,4 +247,4 @@ namespace refactor::computation {
}

refactor::graph_topo::Graph<Node, Edge> const &Graph::internal() const { return _internal; }
}// namespace refactor::computation
}// namespace refactor::computation

0 comments on commit 6dd0d69

Please sign in to comment.