-
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
Consider measurements when resolving to jax-jit
, fix indexing issues with DeviceArray
in QubitDevice
#2427
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #2427 +/- ##
=======================================
Coverage 99.45% 99.45%
=======================================
Files 244 244
Lines 18976 18978 +2
=======================================
+ Hits 18872 18874 +2
Misses 104 104
Continue to review full report at Codecov.
|
jax-jit
, fix indexing issues with DeviceArray
in QubitDevice
jax-jit
, fix indexing issues with DeviceArray
in QubitDevice
jax-jit
, fix indexing issues with DeviceArray
in QubitDevice
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.
Thank you @antalszava nice solutions! It looks good to me 💯
@@ -928,6 +928,7 @@ def sample(self, observable, shot_range=None, bin_size=None): | |||
] # Add np.array here for Jax support. | |||
powers_of_two = 2 ** np.arange(samples.shape[-1])[::-1] | |||
indices = samples @ powers_of_two | |||
indices = np.array(indices) # Add np.array here for Jax support. |
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.
Very good catch @antalszava 🕵️♂️
[sc-17102] |
Context:
Raises errors due to:
QubitDevice
and stores under the hood with aDeviceArray
instead of a NumPy array. We have aDeviceArray
because of using thedefault.qubit.jax
device.jax-jit
interface. This is an issue in the automatic change tojax-jit
wheninterface="jax"
is specified.Description of the Change:
jax-jit
interface to be used such that observables are considered too.Benefits:
The original snippet executes without issues.
Possible Drawbacks:
N/A
Related GitHub Issues:
Closes #2406