In addition to issue #2381:
@qjit
@qml.qnode(
qml.device("lightning.qubit", wires=1),
shots=10,
mcm_method="one-shot",
postselect_mode="hw-like",
)
def circuit(b: bool):
qml.H(0)
@cond(b)
def nested():
measure(0, postselect=1)
nested()
return qml.sample(wires=0)
print(circuit(True))
produces unfiltered shots
[[0]
[1]
[0]
[0]
[0]
[0]
[0]
[1]
[1]
[0]]
whereas
@qjit
@qml.qnode(
qml.device("lightning.qubit", wires=1),
shots=10,
mcm_method="one-shot",
postselect_mode="hw-like",
)
def circuit(b: bool):
qml.H(0)
measure(0, postselect=1)
return qml.sample(wires=0)
print(circuit(True))
produces correctly filtered shots
[[-2147483648]
[ 1]
[-2147483648]
[-2147483648]
[ 1]
[-2147483648]
[ 1]
[ 1]
[ 1]
[ 1]]