class_docstr: Test the new VQE syntax of passing the Hamiltonian as an observable.
class_docstr_tok: ["Test","the","new","VQE","syntax","of","passing","the","Hamiltonian","as","an","observable","."]
docstr: Tests VQE gradients in the jax interface.
docstr_tok: ["Tests","VQE","gradients","in","the","jax","interface","."]
code: def test_grad_jax(self, tol):
      """Tests VQE gradients in the jax interface."""
      import jax
      from jax import numpy as jnp
  
      dev = qml.device("default.qubit", wires=4)
      H = big_hamiltonian
      np.random.seed(1967)
      w = jnp.array(PARAMS)
  
      @qml.qnode(dev)
      def circuit(w):
          qml.templates.StronglyEntanglingLayers(w, wires=range(4))
          return qml.expval(H)
  
      dc = jax.grad(circuit)(w)
      assert np.allclose(dc, big_hamiltonian_grad, atol=tol)
  
imports: import copy
  import numpy
  import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 13 for calling the TestNewVQE obj's underlying member method code with example usage: obj.test_grad_jax(tol) and returns: qml