-
Notifications
You must be signed in to change notification settings - Fork 569
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
Clean up QuantumScript._par_info
#3185
Conversation
Co-authored-by: Albert Mitjans <a.mitjanscoma@gmail.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #3185 +/- ##
==========================================
- Coverage 99.69% 99.69% -0.01%
==========================================
Files 275 275
Lines 24014 24012 -2
==========================================
- Hits 23940 23938 -2
Misses 74 74
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it 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.
Just one comment:
The docstring of QuantumScript._update_trainable_params
should be updated:
def _update_trainable_params(self):
"""Set the trainable parameters
Sets:
_trainable_params (list[int]): Script parameter indices of trainable parameters
self._par_info.keys() is assumed to be sorted and up to date when calling
this method. This assumes that self._par_info was created in a sorted manner,
as in _update_par_info.
Call `_update_par_info` before `_update_trainable_params`
"""
Co-authored-by: Albert Mitjans <a.mitjanscoma@gmail.com>
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! 👏
Note that PR branches off of #3097 and must be merged after it.
The
QuantumTape._par_info
(nowQuantumScript._par_info
) was a dictionary mapping from integers starting at zero to a dictionary. This modifies that data structure to be a simple list instead.This required several changes through the code base:
tape._par_info.items()
toenumerate(tape._par_info)
tape._par_info.values()
intotape._par_info
.