-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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.
Looks good. Just some minor comments.
src/operator/optimizer_op-inl.h
Outdated
} | ||
const DType grad_squared = grad_rescaled * grad_rescaled; | ||
state_data[data_j] += grad_squared; | ||
const DType div = grad_rescaled / math::sqrt(state_data[data_j] + epsilon); |
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.
nit : use mshadow_op::square_root::Map
? Seems that other kernels use mshadow_op
instead of directly call math func
src/operator/optimizer_op-inl.h
Outdated
state_data[data_j] += grad_squared; | ||
const DType div = grad_rescaled / math::sqrt(state_data[data_j] + epsilon); | ||
// No need to use KERNEL_ASSIGN, as we already checked req is kWriteInplace | ||
out_data[data_j] = weight_data[data_j] + div * -lr; |
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.
nit : ... - div * lr
?
'rescale_grad': self.rescale_grad} | ||
if self.clip_gradient: | ||
kwargs['clip_gradient'] = self.clip_gradient | ||
sparse.adagrad_update(weight, grad, history, out=weight, lr=lr, wd=wd, **kwargs) |
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.
since wd is still passed to the operator, we can just check whether wd is 0 or not in the backend.
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.
Done
float wd; | ||
DMLC_DECLARE_PARAMETER(AdagradParam) { | ||
DMLC_DECLARE_FIELD(lr) | ||
.describe("Learning rate"); |
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.
indentation?
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.
It's indented. What's the concern?
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.
nevermind. it's correct
Is this ready to go in? |
Hi everyone, Considering the |
* fix adagrad * add test * fix lint * CR comments * remove raise in python * enhance unit test * revert wd changes * revert dense op changes
* fix adagrad * add test * fix lint * CR comments * remove raise in python * enhance unit test * revert wd changes * revert dense op changes
* fix adagrad * add test * fix lint * CR comments * remove raise in python * enhance unit test * revert wd changes * revert dense op changes
* fix adagrad * add test * fix lint * CR comments * remove raise in python * enhance unit test * revert wd changes * revert dense op changes
Description
RowSparseNDArray.indices
andRowSparseNDArray.data
.@ZiyueHuang @piiswrong @sxjscience @cjolivier01 @szha
Commit author is mistaken. Nvm.
Checklist
Essentials
make lint
)Changes
Comments