Hello! I’m trying to implement a circuit with several mid-circuit measurements on the auxiliary qubit. A post-selection and a resetting is intended to be applied after the measurement. The following is a simple example, and it will run into an error:
import pennylane as qml
dev=qml.device("default.qubit", wires=2)
@qml.qnode(dev)
def circuit():
for i in range(3):
qml.H(0)
qml.measure(0, reset=True, postselect=0)
return qml.expval(qml.X(1))
circuit()
The error information is:
File "C:\Users\Timmy\AppData\Local\Programs\Python\Python312\Lib\site-packages\pennylane\devices\preprocess.py", line 144, in validate_device_wires
raise WireError(
pennylane.exceptions.WireError: Cannot run circuit(s) on default.qubit as they contain wires not found on the device: {2, 3, 4}
It indicates that I’m trying to operate the qubit 2 and 3, but my code does not operate these qubits. If I replace the statement qml.measure(0, reset=True, postselect=0) with qml.measure(0, reset=False, postselect=0), the same type of error will also occur.
My qml.about:
Version: 0.43.1
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemi
stry. Train a quantum computer the same way as a neural network. Home-page:
Author:
Author-email:
License-Expression: Apache-2.0
Location: C:\Users\Timmy\AppData\Local\Programs\Python\Python312\Lib\site-packages
Requires: appdirs, autograd, autoray, cachetools, diastatic-malt, networkx, numpy, packaging, pennylane-lightning, reque
sts, rustworkx, scipy, tomlkit, typing_extensions Required-by: pennylane_lightning
Platform info: Windows-11-10.0.26220-SP0
Python version: 3.12.7
Numpy version: 2.3.4
Scipy version: 1.16.2
JAX version: None
Installed devices:
- default.clifford (pennylane-0.43.1)
- default.gaussian (pennylane-0.43.1)
- default.mixed (pennylane-0.43.1)
- default.qubit (pennylane-0.43.1)
- default.qutrit (pennylane-0.43.1)
- default.qutrit.mixed (pennylane-0.43.1)
- default.tensor (pennylane-0.43.1)
- null.qubit (pennylane-0.43.1)
- reference.qubit (pennylane-0.43.1)
- lightning.qubit (pennylane_lightning-0.43.0)