Skip to content

Commit

Permalink
fix bugs under kSgdSparseCpuTraining mode
Browse files Browse the repository at this point in the history
Local training with "sparse_update = True" parameter triggers kSgdSparseCpuTraining mode, fix bugs under it.
  • Loading branch information
Zrachel committed Sep 23, 2016
1 parent 7eb29f2 commit 16bbf25
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion paddle/trainer/ThreadParameterUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void SgdThreadUpdater::traverse(GetTraverseCallback getTraverseCallback) {
} else if (hasCpuPara) {
getGlobalSyncThreadPool()->exec(cpuTraverse);
} else if (hasGpuPara) {
cpuTraverse(0, 0);
gpuTraverse(0, 0);
}
}

Expand Down
1 change: 1 addition & 0 deletions paddle/trainer/TrainerInternal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ void TrainerInternal::trainOneBatch(int64_t batchId,
// it
//! to ParameterHook.
auto& grad = para->getBuf(PARAMETER_GRADIENT);
SetDevice device(para->getDeviceId());
paraStats[para->getID()].avgAbsGrad = grad->getAbsSum() / para->getSize();
paraStats[para->getID()].maxAbsGrad = grad->getAbsMax();
}
Expand Down

0 comments on commit 16bbf25

Please sign in to comment.