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 qubitdensitymatrix on default.mixed #5203

Merged
merged 3 commits into from
Feb 15, 2024
Merged

Conversation

timmysilv
Copy link
Contributor

Context:
Jax-jit (or any tracing tool) does not allow reading/depending on the concrete value of a tracer. default.mixed currently validates the trace of the parameter passed to QubitDensityMatrix before applying it.

Description of the Change:
If the parameter is abstract, do not validate it

Benefits:
default.mixed can now use QubitDensityMatrix with jax-jit

Possible Drawbacks:
It will now try to apply invalid density matrices because it cannot check it. This (skipping validation of concrete values while tracing) is common practice in PennyLane, so it should be ok.

Related GitHub Issues:
Fixes #5196

@timmysilv timmysilv requested a review from a team February 14, 2024 15:30
Copy link

codecov bot commented Feb 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1ed7311) 99.68% compared to head (d5c8720) 99.68%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5203      +/-   ##
==========================================
- Coverage   99.68%   99.68%   -0.01%     
==========================================
  Files         396      396              
  Lines       36638    36366     -272     
==========================================
- Hits        36524    36251     -273     
- Misses        114      115       +1     

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

@timmysilv timmysilv requested a review from a team February 14, 2024 20:47
# Conflicts:
#	doc/releases/changelog-dev.md
@timmysilv timmysilv enabled auto-merge (squash) February 15, 2024 15:40
@timmysilv timmysilv merged commit ae03035 into master Feb 15, 2024
36 checks passed
@timmysilv timmysilv deleted the fix-qubit-density-matrix branch February 15, 2024 15:53
timmysilv added a commit that referenced this pull request Feb 26, 2024
I started this in #5203, but missed the case when it's only applied to a
subset of the device wires. This handles that case now as well

Fixes #5235
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] Incompatibility of jax with device default.mixed and qml.QubitDensityMatrix()
3 participants