diff --git a/CHANGELOG.md b/CHANGELOG.md index fe9754068..a7cf61142 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ ### Breaking changes 💔 +* The old return type system has been removed. + [(#331)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/331) + ### Deprecations 👋 ### Documentation 📝 @@ -16,6 +19,8 @@ This release contains contributions from (in alphabetical order): +Mudit Pandey, + --- # Release 0.32.0 diff --git a/pennylane_qiskit/qiskit_device.py b/pennylane_qiskit/qiskit_device.py index 1ab342002..6e91a94fd 100644 --- a/pennylane_qiskit/qiskit_device.py +++ b/pennylane_qiskit/qiskit_device.py @@ -22,7 +22,6 @@ import warnings import numpy as np -import pennylane from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister from qiskit import extensions as ex from qiskit.compiler import transpile @@ -499,15 +498,10 @@ def batch_execute(self, circuits, timeout: int = None): if self.shots is not None or circuit.is_sampled: self._samples = self.generate_samples(circuit_obj) - if not pennylane.active_return(): - res = self._statistics_legacy(circuit) - res = np.asarray(res) - results.append(res) - else: - res = self.statistics(circuit) - single_measurement = len(circuit.measurements) == 1 - res = res[0] if single_measurement else tuple(res) - results.append(res) + res = self.statistics(circuit) + single_measurement = len(circuit.measurements) == 1 + res = res[0] if single_measurement else tuple(res) + results.append(res) if self.tracker.active: self.tracker.update(batches=1, batch_len=len(circuits)) diff --git a/tests/test_qiskit_device.py b/tests/test_qiskit_device.py index e865a8a47..5474c21d3 100644 --- a/tests/test_qiskit_device.py +++ b/tests/test_qiskit_device.py @@ -140,31 +140,6 @@ def test_calls_to_reset(self, n_tapes, mocker, device): assert spy.call_count == n_tapes - def test_result_legacy(self, device, tol): - """Tests that the result has the correct shape and entry types.""" - # TODO: remove once the legacy return system is removed. - qml.disable_return() - dev = device(2) - tapes = [self.tape1, self.tape2] - res = dev.batch_execute(tapes) - - # We're calling device methods directly, need to reset before the next - # execution - dev.reset() - tape1_expected = dev.execute(self.tape1) - - dev.reset() - tape2_expected = dev.execute(self.tape2) - - assert len(res) == 2 - assert isinstance(res[0], np.ndarray) - assert np.allclose(res[0], tape1_expected, atol=0) - - assert isinstance(res[1], np.ndarray) - assert np.allclose(res[1], tape2_expected, atol=0) - - qml.enable_return() - def test_result(self, device, tol): """Tests that the result has the correct shape and entry types.""" dev = device(2)