-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Adam selectedrows and scatter functors #7045
Adam selectedrows and scatter functors #7045
Conversation
paddle/operators/adam_op.h
Outdated
T mom2 = moment2_[rows_[i] * row_numel_ + j]; | ||
T lr = *lr_; | ||
T beta1_pow = *beta1_pow_; | ||
T beta2_pow = *beta2_pow_; |
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.
T lr = *lr_;
T beta1_pow = *beta1_pow_;
T beta2_pow = *beta2_pow_;
For GPU, these operations are always call the data from memory to register?
paddle/operators/adam_op.h
Outdated
mom2 = beta2_ * mom2 + (1 - beta2_) * g * g; | ||
p -= lr * (mom1 / (sqrt(mom2) + epsilon_)); | ||
// IMPORTANT: | ||
// FIXME(typhoonzero): row id may be duplicate |
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.
Sparse Adagrad merges row id first. Please refer to https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/operators/adagrad_op.cc#L107.
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.
Thanks! Will update this.
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.
LGTM
if (tid == 0) { | ||
for (size_t i = 0; i < out_rows_size; i++) { | ||
if (input_rows[ty] == out_rows[i]) { | ||
out_idx = i; |
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.
We can add a break here.
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.
Sure. I'll try to fix in next PR since I'm considering a way to simplify the functors.
Fix #7019
Start: 2017.12.27
Due: 2018.1.3