Hello,
I am wondering if there is a way in Pennylane to calculate the expectation of an observable based on counts outside of a qnode circuit?
For example, with this circuit is there method within pennylane to easily calculate the expectation value as if we would have returned [qp.expval(qp.PauliX(i)) for i in device.wires] in the qnode?
device = qp.device("default.qubit", 4)
@qp.set_shots(1000)
@qp.qnode(device)
def circuit():
qp.H(wires=[i])
return qp.counts(wires=device.wires)
counts = circuit()
Thank you!