Follow-up: I drafted a PR that should allow your code to run: #5452.
You can clone the repository, check out this PR’s branch and install pennylane from the directory to try this out now, or wait for the release that will contain this patch
As far as I can tell, your code will run successfully with this patch, as long as you replace the np.arccos
call by cnp.arccos
. As a rule of thumb, it’s a good idea to move classical processing outside of QNodes to avoid problems with trainability (In your code, np.arccos
makes the vanilla numpy array into a trainable autograd numpy array, causing some funky issue )
Hope this helps! Happy coding