-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug in MultiGradientMachine. #2650
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, LGTM.
@@ -601,7 +601,7 @@ void TrainerThread::backward() { | |||
|
|||
void TrainerThread::backwardCallback(Parameter* para) { | |||
// CPU parameters are merged in the end | |||
if (!para->useGpu()) return; | |||
if (!para->useGpu() || para->isStatic()) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to add detail comments here.
@@ -601,7 +601,7 @@ void TrainerThread::backward() { | |||
|
|||
void TrainerThread::backwardCallback(Parameter* para) { | |||
// CPU parameters are merged in the end | |||
if (!para->useGpu()) return; | |||
if (!para->useGpu() || para->isStatic()) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the batch size for one thread is 0, all the parameters will call backwardCallback
function to merge gradient in the line 593. But the static parameters which do not need to be updated should not call backwardCallback
. So add a check here.
Fix #2649