-
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
Implementing the Adamax optimizer operator #4538
Conversation
paddle/operators/adamax_op.h
Outdated
float beta_1 = ctx.Attr<float>("beta_1"); | ||
float beta_2 = ctx.Attr<float>("beta_2"); | ||
float epsilon = ctx.Attr<float>("epsilon"); | ||
int t = ctx.Attr<int>("time_step"); |
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.
The timestep should not be an attribute. It should be an input of Adamax. That input type could be int
.
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.
Thank you for the feedback. I will change 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.
|
||
|
||
class TestAdamaxOp1(OpTest): | ||
def setUp(self): |
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.
You provided two TestAdamaxOp functions and commented that the second one is for testing default attributes. I think it would be helpful to also add a comment for TestAdamaxOp1 explaining its purpose. Also, I didn't find any differences between the two test functions. If the first function is to test explicit attributes, you should change the attribute values.
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.
Thank you. I forgot to remove the attributes from the second one . Will change this.
} | ||
|
||
def test_check_output(self): | ||
self.check_output() |
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.
The test of this kind of operator(Optimizer with state) should be more complex because we have accumulated state. The state will change when running, so the test code should run multiple times to check if the state is right.
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.
Fixed in af36e75
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 job! LGTM~
Fixes #4515