Skip to content

Commit

Permalink
Test changes to account for 0.39 deprecations (#912)
Browse files Browse the repository at this point in the history
Updating some tests to account for various deprecations happening in
pennylane for v0.39.

---------

Co-authored-by: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
  • Loading branch information
mudit2812 and ringo-but-quantum authored Sep 17, 2024
1 parent 410f8b8 commit 3718dd6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

### Improvements

* Update the test suite to remove deprecated code.
[(#912)](https://github.com/PennyLaneAI/pennylane-lightning/pull/912)

* Skip the compilation of Lightning simulators and development requirements to boost the build of public docs up to 5x.
[(#904)](https://github.com/PennyLaneAI/pennylane-lightning/pull/904)

Expand Down Expand Up @@ -75,7 +78,7 @@

This release contains contributions from (in alphabetical order):

Ali Asadi, Amintor Dusko, Luis Alfredo Nuñez Meneses, Vincent Michaud-Rioux, Lee J. O'Riordan, Shuli Shu
Ali Asadi, Amintor Dusko, Luis Alfredo Nuñez Meneses, Vincent Michaud-Rioux, Lee J. O'Riordan, Mudit Pandey, Shuli Shu

---

Expand Down
6 changes: 3 additions & 3 deletions mpitests/test_adjoint_jacobian.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ def circuit(params):
def test_qubit_unitary(dev, n_targets):
"""Tests that ``qml.QubitUnitary`` can be included in circuits differentiated with the adjoint method."""
n_wires = len(dev.wires)
dev_def = qml.device("default.qubit.legacy", wires=n_wires)
dev_def = qml.device("default.qubit", wires=n_wires)
h = 1e-3 if dev.R_DTYPE == np.float32 else 1e-7
c_dtype = np.complex64 if dev.R_DTYPE == np.float32 else np.complex128

Expand All @@ -1396,7 +1396,7 @@ def test_qubit_unitary(dev, n_targets):

init_state = np.array(init_state, requires_grad=False, dtype=c_dtype)
U = np.array(U, requires_grad=False, dtype=c_dtype)
obs = qml.operation.Tensor(*(qml.PauliZ(i) for i in range(n_wires)))
obs = qml.prod(*(qml.PauliZ(i) for i in range(n_wires)))

def circuit(x):
qml.StatePrep(init_state, wires=range(n_wires))
Expand Down Expand Up @@ -1444,7 +1444,7 @@ def test_diff_qubit_unitary(dev, n_targets):

init_state = np.array(init_state, requires_grad=False, dtype=c_dtype)
U = np.array(U, requires_grad=False, dtype=c_dtype)
obs = qml.operation.Tensor(*(qml.PauliZ(i) for i in range(n_wires)))
obs = qml.prod(*(qml.PauliZ(i) for i in range(n_wires)))

def circuit(x, u_mat):
qml.StatePrep(init_state, wires=range(n_wires))
Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.39.0-dev24"
__version__ = "0.39.0-dev25"
2 changes: 1 addition & 1 deletion tests/test_adjoint_jacobian.py
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ def test_qubit_unitary(n_targets):
"""Tests that ``qml.QubitUnitary`` can be included in circuits differentiated with the adjoint method."""
n_wires = 6
dev = qml.device(device_name, wires=n_wires)
dev_def = qml.device("default.qubit.legacy", wires=n_wires)
dev_def = qml.device("default.qubit", wires=n_wires)

np.random.seed(1337)
init_state = np.random.rand(2**n_wires) + 1j * np.random.rand(2**n_wires)
Expand Down

0 comments on commit 3718dd6

Please sign in to comment.