Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
readability
Browse files Browse the repository at this point in the history
  • Loading branch information
larroy committed Apr 19, 2019
1 parent 5d162a3 commit 1b93548
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/nnvm/gradient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,23 @@ Graph Gradient(Graph src) {
<< "because it is unreachable from the outputs.";
}

// construct mirror reduece memory strategy if needed
// construct mirror as memory reduction strategy if needed
std::unordered_map<Node*, NodePtr> mirror_map;
if (mirror_fun != nullptr) {
for (const NodePtr& n : topo_order) {
if (mirror_fun(*n)) {
for (const NodePtr& node_ptr : topo_order) {
if (mirror_fun(*node_ptr)) {
NodePtr new_node = Node::Create();
*new_node = *n;
*new_node = *node_ptr;
new_node->attrs.name += "_mirror";
for (auto& e : new_node->inputs) {
e.node = mirror_map.at(e.node.get());
}
for (auto& n : new_node->control_deps) {
n = mirror_map.at(n.get());
}
mirror_map[n.get()] = std::move(new_node);
mirror_map[node_ptr.get()] = std::move(new_node);
} else {
mirror_map[n.get()] = n;
mirror_map[node_ptr.get()] = node_ptr;
}
}
}
Expand Down

0 comments on commit 1b93548

Please sign in to comment.