Skip to content

Commit 5422776

Browse files
authored
Merge pull request #12 from qingqing01/framework_proto
make unit test of backward_test pass.
2 parents f485815 + aad49da commit 5422776

File tree

3 files changed

+249
-216
lines changed

3 files changed

+249
-216
lines changed

paddle/framework/backward.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ template <typename Map, typename T>
2525
static void ForEachVarName(Map& names, T callback) {
2626
for (auto& name : names) {
2727
for (auto& n : name.second) {
28-
if (callback(n)) break;
28+
if (callback(n)) return;
2929
}
3030
}
3131
}
3232

3333
static bool AllInSet(
3434
const std::unordered_map<std::string, std::vector<std::string>>& names,
3535
const std::string& suffix, const std::unordered_set<std::string>& set) {
36-
bool ret_val = true;
37-
ForEachVarName(names, [&ret_val, &set, &suffix](const std::string& n) {
38-
ret_val = set.find(n + suffix) == set.end();
39-
return !ret_val;
36+
bool all_in_set = true;
37+
ForEachVarName(names, [&all_in_set, &set, &suffix](const std::string& n) {
38+
all_in_set = set.find(n + suffix) != set.end();
39+
return !all_in_set;
4040
});
41-
return ret_val;
41+
return all_in_set;
4242
}
4343

4444
static std::shared_ptr<OperatorBase> NOP() {

0 commit comments

Comments
 (0)