提交 51ca5089 编写于 作者: M minqiyang

Change the iteration direction in ingrads' map slots

test=develop
上级 d16cb8ca
......@@ -117,14 +117,14 @@ class Autograd {
std::map<OpBase*, int> dep_counts = ComputeDepCounts(var->PreOp());
while (!ready.empty()) {
OpBase* ready_op = ready.back();
ready.pop_back();
OpBase* ready_op = ready.front();
ready.pop_front();
std::map<std::string, std::vector<VarBase*>> input_grads =
ready_op->ApplyGrad();
for (auto it = input_grads.rbegin(); it != input_grads.rend(); ++it) {
const std::vector<VarBase*>& ingrads = it->second;
for (int64_t i = ingrads.size() - 1; i >= 0; --i) {
for (size_t i = 0; i < ingrads.size(); ++i) {
if (!ingrads[i]) continue;
if (ready_op->input_vars_[it->first][i]->IsStopGradient()) {
continue;
......
......@@ -303,7 +303,7 @@ use_py_reader = False
sync = False
# how many batches we use
batch_num = 2
batch_num = 50
np.random.seed = 1
src_word_np = np.random.randint(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册