Skip to content

Commit

Permalink
Graph::rebind_output: nested levels were decreased.
Browse files Browse the repository at this point in the history
  • Loading branch information
Litvinov Mikhail committed Nov 19, 2024
1 parent 8f9118a commit 5444424
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions src/model/dfcxx/lib/dfcxx/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,30 +123,29 @@ Node Graph::rebindOutput(Node output, Node target, Graph &graph) {
auto &inSrc = graph.inputs[output].front().source;
auto &outs = graph.outputs[inSrc];
for (auto it = outs.begin(); it != outs.end(); ++it) {
if (it->target == output) {
if (target.type == OpType::NONE) {
outs.erase(it);
for (auto &out: outputs[target]) {
for (auto &in: inputs[out.target]) {
if (in.source == target && out == in) {
in.source = it->source;
outs.push_back(in);
}
}
auto conIt = connections.find(out.target);
if (conIt != connections.end() && conIt->second.source == target) {
conIt->second.source = it->source;
if (it->target != output) { continue; }
if (target.type == OpType::NONE) {
outs.erase(it);
for (auto &out: outputs[target]) {
for (auto &in: inputs[out.target]) {
if (in.source == target && out == in) {
in.source = it->source;
outs.push_back(in);
}
}
target = it->source;
} else {
it->target = target;
inputs[target].clear();
inputs[target].push_back(*it);
connections[target] = *it;
auto conIt = connections.find(out.target);
if (conIt != connections.end() && conIt->second.source == target) {
conIt->second.source = it->source;
}
}
break;
target = it->source;
} else {
it->target = target;
inputs[target].clear();
inputs[target].push_back(*it);
connections[target] = *it;
}
break;
}
return target;
}
Expand Down

0 comments on commit 5444424

Please sign in to comment.