TorchLayer always returns all exp_vals

When we use a circuit with TorchLayer, it automatically returns a tensor containing the expectation values of all the measured observables in the circuit. In my case, since we have three expectation values (qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ(1)),
qml.expval(qml.PauliZ(2))), it returns a tensor of shape (3,) containing these values.
On the other hand, when I directly invoke my ANZATS, it only returns the expectation value of qml.expval(qml.PauliZ(0)) because that’s the value explicitly returned in the function.

Why is TorchLayer ignoring qml.expval(qml.PauliZ(0))? Thanks

Never mind, a bug in my code :slight_smile:

Hey @Solomon! Glad you found your bug :tada:. Nice work!