Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Context:** In PennyLaneAI/pennylane#6939, a fix was made to `qml.expval` so that it no longer silently converts the result to a real number. However, in `tutorial_pulse_programming101.py` we use a Hamiltonian with complex-typed coefficients. This resulted in an imaginary expectation value (`X+0j`) and broke the `jax.value_and_grad` function. **Description of change:** Wrap the `qnode` function to get the expectation value and convert it to a real number. This allows `jax.value_and_grad` to be used and fixes the demo.
- Loading branch information