[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

Make process_samples on SampleMP jit-compatible with Tracer indices #6211

Merged
merged 19 commits into from
Sep 6, 2024

Conversation

lillian542
Copy link
Contributor
@lillian542 lillian542 commented Sep 4, 2024

Context:
There is a use case in catalyst (currently a WIP, sampling an observable using measurements_from_samples to diagonalize everything) that results in indices in the process_samples function being an abstract Tracer, and then things break that don't need to.

Description of the Change:
Update the jax take dispatch in qml.math to cast indices to a jax array instead of a vanilla numpy array

@lillian542 lillian542 marked this pull request as ready for review September 4, 2024 14:54
Copy link
Contributor
github-actions bot commented Sep 4, 2024

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link
codecov bot commented Sep 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.60%. Comparing base (3482df3) to head (03c1a14).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6211      +/-   ##
==========================================
+ Coverage   98.30%   99.60%   +1.29%     
==========================================
  Files         445      445              
  Lines       43152    42364     -788     
==========================================
- Hits        42422    42195     -227     
+ Misses        730      169     -561     

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

@lillian542 lillian542 changed the title [WIP] Make process_samples on SampleMP jit-compatible Make process_samples on SampleMP jit-compatible Sep 4, 2024
@lillian542 lillian542 changed the title Make process_samples on SampleMP jit-compatible Make process_samples on SampleMP jit-compatible with Tracer indices Sep 4, 2024
tests/test_compiler.py Outdated Show resolved Hide resolved
Copy link
Contributor
@astralcai astralcai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of non-blocking comments.

doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
pennylane/measurements/sample.py Show resolved Hide resolved
Copy link
Contributor
@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@lillian542
Copy link
Contributor Author

[sc-60183]

@lillian542 lillian542 enabled auto-merge (squash) September 6, 2024 18:28
@lillian542 lillian542 merged commit 40195fd into master Sep 6, 2024
37 checks passed
@lillian542 lillian542 deleted the process_samples_jit branch September 6, 2024 19:04
mudit2812 pushed a commit that referenced this pull request Sep 10, 2024
…6211)

**Context:**
There is a use case in catalyst (currently a WIP, sampling an observable
using `measurements_from_samples` to diagonalize everything) that
results in `indices` in the `process_samples` function being an abstract
`Tracer`, and then things break that don't need to.

**Description of the Change:**
Update the jax `take` dispatch in `qml.math` to cast indices to a jax
array instead of a vanilla numpy array
mudit2812 pushed a commit that referenced this pull request Sep 12, 2024
…6211)

**Context:**
There is a use case in catalyst (currently a WIP, sampling an observable
using `measurements_from_samples` to diagonalize everything) that
results in `indices` in the `process_samples` function being an abstract
`Tracer`, and then things break that don't need to.

**Description of the Change:**
Update the jax `take` dispatch in `qml.math` to cast indices to a jax
array instead of a vanilla numpy array
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.

3 participants