-
Notifications
You must be signed in to change notification settings - Fork 603
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 broadcasting in the numerical representations of standard operations #2609
Conversation
[sc-18891] |
Codecov Report
@@ Coverage Diff @@
## parameter-broadcasting-1 #2609 +/- ##
==========================================================
Coverage 99.58% 99.58%
==========================================================
Files 245 245
Lines 19700 19823 +123
==========================================================
+ Hits 19618 19741 +123
Misses 82 82
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.
An amazing PR @dwierichs 💪
I left mostly questions for my own understanding for the main logic additions.
Regarding the tests, it would be great if existing tests could be left as-is where it makes sense, and new test classes TestSomethingBatched:
were added? This would provide some peace of mind that existing functionality is preserved, while also adding tests that are explicitly testing the batched functionality.
Co-authored-by: Josh Izaac <josh146@gmail.com>
Thanks for the review, @josh146 ! |
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.
Amazing work @dwierichs! Thanks for revising the tests, they now look 👌
Co-authored-by: Josh Izaac <josh146@gmail.com>
…oadcasting (#2590) * introduce Operator.ndim_params, Operator.batch_size, QuantumTape.batch_size * linting * changelog * enable tf.function input_signature usage * black * test for unsilenced error * Apply suggestions from code review Co-authored-by: Josh Izaac <josh146@gmail.com> * introduce device flag and batch_transform for unbroadcasting; use transform in device.batch_transform * black, [skip ci] * code review * string formatting [skip ci] * operation broadcasting interface tests * unbroadcast_expand * tests for expand function * tests * black * compatibility with TensorFlow 2.6 * builtins unstack * failing case coverage * stop using I in operation.py [skip ci] * Apply suggestions from code review Co-authored-by: Josh Izaac <josh146@gmail.com> * review * Apply suggestions from code review Co-authored-by: Josh Izaac <josh146@gmail.com> * review [skip ci] * move changelog section from "improvements" to "new features" * changelog * add missing files * namespace * linting variable names * pin protobuf<4.21.0 * docstring * unpin protobuf * Allow broadcasting in the numerical representations of standard operations (#2609) * commit old changes * intermed * clean up, move broadcast dimension first * update tests that manually set ndim_params for default ops * pin protobuf<4.21.0 * improve shape coersion order * changelog formatting * broadcasted pow tests * attribute test, ControlledQubitUnitary update * test kwargs attributes * Apply suggestions from code review Co-authored-by: Josh Izaac <josh146@gmail.com> * changelog * review * remove prints * explicit attribute supports_broadcasting tests * tests disentangle * fix * PauliRot broadcasted identity compatible with TF * rename "batched" into "broadcasted" for uniform namespace * old TF version support in qubitunitary unitarity check * python3.7 support * Apply suggestions from code review Co-authored-by: Josh Izaac <josh146@gmail.com> * linebreak Co-authored-by: Josh Izaac <josh146@gmail.com> * black * black again * feature collision amend tests * black [skip ci] Co-authored-by: Josh Izaac <josh146@gmail.com>
This PR is a duplicate of #2535 that follows the conventions set up in #2575 and #2590 instead.
It sets the
ndim_params
attribute for many standard operations and allows for broadcasting in their numerical representations (mostlycompute_matrix
andcompute_eigvals
).