Skip to content
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 bug with CNOT/PauliZ, TF and large batched states #4889

Merged
merged 4 commits into from Nov 28, 2023

Conversation

timmysilv
Copy link
Contributor

@timmysilv timmysilv commented Nov 28, 2023

Context:
First reported on the forum. qml.CNOT uses apply_operation_tensordot when that state has >=9 dims and the interface is tensorflow, but the is_state_batched param was missing (so it always assumed it wasn't batched). While fixing this, I noticed that it was also missing with PauliZ.

Description of the Change:
Pass the correct is_state_batched value to apply_operation_tensordot when called from the CNOT and PauliZ apply functions.

Benefits:
No more unexpected errors. I think sometimes they would not raise error, but give unexpected results. That shouldn't happen either now.

Possible Drawbacks:
N/A

Fixes #4892

@timmysilv timmysilv requested a review from a team November 28, 2023 15:32
Copy link

codecov bot commented Nov 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (34a561a) 99.65% compared to head (b2e161e) 99.64%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4889      +/-   ##
==========================================
- Coverage   99.65%   99.64%   -0.02%     
==========================================
  Files         388      388              
  Lines       34964    34700     -264     
==========================================
- Hits        34844    34577     -267     
- Misses        120      123       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@timmysilv timmysilv enabled auto-merge (squash) November 28, 2023 17:57
@timmysilv timmysilv merged commit 7cb7b7a into master Nov 28, 2023
35 checks passed
@timmysilv timmysilv deleted the fix-cnot-batched branch November 28, 2023 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] CNOT and PauliZ do not work with large batched states and tensorflow
3 participants