catalyst
catalyst copied to clipboard
`qml.sample` differs in shape when using Catalyst
from catalyst import qjit, measure, cond
import pennylane as qml
@qml.qnode(qml.device("lightning.qubit", wires=1, shots=100))
def circuit():
return qml.sample()
print(circuit().shape)
print(qjit(circuit)().shape)
$ python test.py
(100,)
(100, 1)
Not a bug, that is how we return the samples, but it would be a nice improvement to unify the output. Could probably be solved together with #341
Note that PennyLane always produces a 2D array (n_shots, n_qubits), except when there is only one wire. I think this is a bit inconsistent so I've proposed to adjust this on the PennyLane side.