-
Notifications
You must be signed in to change notification settings - Fork 575
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
Allow custom range sequence in StronglyEntanglingLayers #1332
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1332 +/- ##
=======================================
Coverage 98.16% 98.16%
=======================================
Files 145 145
Lines 11093 11099 +6
=======================================
+ Hits 10889 10895 +6
Misses 204 204
Continue to review full report at Codecov.
|
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 for this nice contribution @wongwsvincent! Is this PR now ready for review?
Co-authored-by: Josh Izaac <josh146@gmail.com>
Hi @josh146 , I am having trouble not decreasing the coverage of the tests. I included a |
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 so much for this contribution @wongwsvincent, this is great!
I left a few comments, but most are just nitpicking, and I am happy to be convinced otherwise...
About the coverage: you can (and should) test all errors with the context with pytest.raises(ValueError, match="<part_of_the_error_message>"):
, in which you can create the op. If the error is not raised, the test will fail. Would that help, or did I misunderstand your problem?
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Thanks so much for reviewing the code, @mariaschuld . |
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.
Hey @wongwsvincent .
Thanks for updating the PR - you notice that we are quite strict with code review :)
The only last change would be to move the error tests into a separate test function, then it's ready to be merged from my side! Just ask for a new review when this is done.
Oh, and don't forget to add yourself to the list of contributors in the CHANGELOG (at the bottom of the new version's release notes) if you're not already there!
I actually appreciate the strict code review a lot. It's my first time contributing and I definitely learned a lot =D I have moved the check of error raising regarding the range values to a separate test function. And gratefully added my name in the CHANGELOG Code should be ready for re-review @mariaschuld |
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.
Perfect, from my side ready to merge!
Context:
Fixing a bug to allow the usage of custom range sequence in
StronglyEntanglingLayers
Description of the Change:
is longer than the number of layers
, then it takes only the first
range values in the sequence.
The
ranges
parameter can now be defined properly if a specific sequence is defined by the user.The range value is checked such that it's not zero or divisible by the number of wires.
If the range sequence length
If the range sequence length is shorter than the number of layers, the range sequence is repeated.
A test is also added to test the custom range sequence feature.
Related GitHub Issues:
Resolves issue #1330