-
Notifications
You must be signed in to change notification settings - Fork 586
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 how trainable args are counted for gradients in GradientDescentOptimizer
and NesterovMomentumOptimizer
#1495
Merged
Merged
Changes from 12 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
caed76a
count the trainable args, not simply the args
antalszava d586c24
Merge branch 'master' into ch7853-fix_grad_desc_mult_args
antalszava c79f5c0
changelog
antalszava b07357f
update nesterov opt too
antalszava 08fa4eb
update nesterov opt too
antalszava c57a3fb
comment
antalszava 4751c69
changelog update
antalszava 9d2af7c
remove redundant enumerate
antalszava cbe3457
format
antalszava eba42af
add another test for two trainable args
antalszava 0ea45d7
extract trainable args
antalszava c45226e
enumerate trainable args
antalszava d8ca734
Update tests/test_optimize.py
antalszava a0d468c
Update tests/test_optimize.py
antalszava 386eb77
apply suggestion
antalszava e29725f
Merge branch 'ch7853-fix_grad_desc_mult_args' of github.com:PennyLane…
antalszava f448a4d
add new test case
antalszava 210a32c
test docstring
antalszava 0b58d3e
Revert "apply suggestion"
antalszava 5e400fe
format
antalszava 7a02ff8
remove extra dimensionality from non-trainable
antalszava 2d85634
create a fixture that returns a new optimizer object for each test ca…
antalszava 9e5526e
format test
antalszava 675b7fc
Update tests/test_optimize.py
antalszava ad0eb38
Merge branch 'master' into ch7853-fix_grad_desc_mult_args
antalszava File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@antalszava you might be able to use the new
functionality I just merged into the math module!
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.
(optional, though)
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.
This didn't seem to have worked for some tests 🤔
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.
No worries! We'll need to remember to update this in the future, if
requires_grad=False
by defaultThere 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 issue seems to be that if the argument is not a PennyLane NumPy tensor, then it'll be considered to belong to the "numpy" interface (instead of the "autgrad" interface), and all "numpy" arguments automatically evaluate as
False
when callingutils.requires_grad(arg)
. So, whenever anarg
is simply a floatget_trainable_indices
would consider it non-trainiable, while that seems to not be what's wanted here.