-
Notifications
You must be signed in to change notification settings - Fork 615
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
[BUG] BasisEmbedding
does not work with lightning.qubit
and jax.jit
#6008
Labels
bug 🐛
Something isn't working
Comments
I'd bet the issue is that the features are treated as a hyperparameter, not as a numeric array. So we don't convert it to numpy, and any non-backprop device can't handle things that aren't numpy. |
Yes, I think so :) |
KetpuntoG
added a commit
that referenced
this issue
Aug 21, 2024
This PR complete part of this story: [[sc-68521](https://app.shortcut.com/xanaduai/story/68521)] Goal: `BasisEmbedding` is an alias of `BasisState`. This way, we don't have duplicate code that does the same thing. In unifying this, I have had to modify some tests due to: - `BasisEmbedding` and `BasisState` throw errors such as "incorrect length" with different messages. Now it will always be the same. (test modified for this reason: `test_default_qubit_legacy.py`, `test_default_qubit_tf.py` `test_default_qubit_torch.py`, `test_state_prep.py`, `test_all_singles_doubles.py` and test_uccsd`) - In `BasisEmbedding`, errors were thrown in `__init__` while in BasisState in `state_vector`. Now they are unified in `__init__`. For this reason, there were tests where the operator was not initialized correctly but no error was thrown since `state_vector` was not being called but now they are detected. To correct this, I have modified the tests: `test_qscript.py`, `test_state_prep.py`, - Now `BasisState` does not decompose `BasisStatePreparation` since we are going to deprecate it. This causes the number of gates after expanding to be affected. In this case I had to modify some test in `test_tape.py`. This PR also solves: - [issue 6008](#6008) - [issue 6007](#6007) - [issue 6006](#6006) --------- Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com> Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com> Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
Closing as this was resolved in #6021 |
mudit2812
pushed a commit
that referenced
this issue
Sep 10, 2024
This PR complete part of this story: [[sc-68521](https://app.shortcut.com/xanaduai/story/68521)] Goal: `BasisEmbedding` is an alias of `BasisState`. This way, we don't have duplicate code that does the same thing. In unifying this, I have had to modify some tests due to: - `BasisEmbedding` and `BasisState` throw errors such as "incorrect length" with different messages. Now it will always be the same. (test modified for this reason: `test_default_qubit_legacy.py`, `test_default_qubit_tf.py` `test_default_qubit_torch.py`, `test_state_prep.py`, `test_all_singles_doubles.py` and test_uccsd`) - In `BasisEmbedding`, errors were thrown in `__init__` while in BasisState in `state_vector`. Now they are unified in `__init__`. For this reason, there were tests where the operator was not initialized correctly but no error was thrown since `state_vector` was not being called but now they are detected. To correct this, I have modified the tests: `test_qscript.py`, `test_state_prep.py`, - Now `BasisState` does not decompose `BasisStatePreparation` since we are going to deprecate it. This causes the number of gates after expanding to be affected. In this case I had to modify some test in `test_tape.py`. This PR also solves: - [issue 6008](#6008) - [issue 6007](#6007) - [issue 6006](#6006) --------- Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com> Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com> Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected behavior
I expect that a circuit running on
default.qubit
orlightning.qubit
, where the circuit containsBasisEmbedding
, should work withjit
.Actual behavior
Using
lightning.qubit
fails.Additional information
I think this will also affect
BasisState
Source code
Tracebacks
System information
Name: PennyLane Version: 0.37.0 Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network. Home-page: https://github.com/PennyLaneAI/pennylane Author: Author-email: License: Apache License 2.0 Location: /Users/isaac/.virtualenvs/pennylane-catalyst/lib/python3.11/site-packages Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml, typing-extensions Required-by: PennyLane-Catalyst, PennyLane_Lightning Platform info: macOS-14.5-arm64-arm-64bit Python version: 3.11.8 Numpy version: 1.26.4 Scipy version: 1.12.0 Installed devices: - default.clifford (PennyLane-0.38.0.dev0) - default.gaussian (PennyLane-0.38.0.dev0) - default.mixed (PennyLane-0.38.0.dev0) - default.qubit (PennyLane-0.38.0.dev0) - default.qubit.autograd (PennyLane-0.38.0.dev0) - default.qubit.jax (PennyLane-0.38.0.dev0) - default.qubit.legacy (PennyLane-0.38.0.dev0) - default.qubit.tf (PennyLane-0.38.0.dev0) - default.qubit.torch (PennyLane-0.38.0.dev0) - default.qutrit (PennyLane-0.38.0.dev0) - default.qutrit.mixed (PennyLane-0.38.0.dev0) - default.tensor (PennyLane-0.38.0.dev0) - null.qubit (PennyLane-0.38.0.dev0) - lightning.qubit (PennyLane_Lightning-0.37.0) - nvidia.custatevec (PennyLane-Catalyst-0.7.0) - nvidia.cutensornet (PennyLane-Catalyst-0.7.0) - oqc.cloud (PennyLane-Catalyst-0.7.0) - softwareq.qpp (PennyLane-Catalyst-0.7.0)
Existing GitHub issues
The text was updated successfully, but these errors were encountered: