class_docstr: Test that using the QNode with Autograd integrates with the PennyLane stack
class_docstr_tok: ["Test","that","using","the","QNode","with","Autograd","integrates","with","the","PennyLane","stack"]
docstr: Test jacobian calculation when no prior circuit evaluation has been performed
docstr_tok: ["Test","jacobian","calculation","when","no","prior","circuit","evaluation","has","been","performed"]
code: def test_jacobian_no_evaluate(
      self,
      interface,
      dev,
      diff_method,
      grad_on_execution,
      tol,
      device_vjp,
  ):
      """Test jacobian calculation when no prior circuit evaluation has been performed"""
      kwargs = dict(
          diff_method=diff_method,
          interface=interface,
          grad_on_execution=grad_on_execution,
          device_vjp=device_vjp,
      )
      if diff_method == "spsa":
          kwargs["sampler_rng"] = np.random.default_rng(SEED_FOR_SPSA)
          tol = TOL_FOR_SPSA
  
      a = np.array(0.1, requires_grad=True)
      b = np.array(0.2, requires_grad=True)
  
      @qnode(dev, **kwargs)
      def circuit(a, b):
          qml.RY(a, wires=0)
          qml.RX(b, wires=1)
          qml.CNOT(wires=[0, 1])
          return qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliY(1))
  
      def cost(x, y):
          return autograd.numpy.hstack(circuit(x, y))
  
      jac_fn = qml.jacobian(cost)
      res = jac_fn(a, b)
      expected = (
          [-np.sin(a), np.sin(a) * np.sin(b)],
          [0, -np.cos(a) * np.cos(b)],
      )
      assert np.allclose(res[0], expected[0], atol=tol, rtol=0)
      assert np.allclose(res[1], expected[1], atol=tol, rtol=0)
  
      # call the Jacobian with new parameters
      a = np.array(0.6, requires_grad=True)
      b = np.array(0.832, requires_grad=True)
  
      res = jac_fn(a, b)
      expected = (
          [-np.sin(a), np.sin(a) * np.sin(b)],
          [0, -np.cos(a) * np.cos(b)],
      )
      assert np.allclose(res[0], expected[0], atol=tol, rtol=0)
      assert np.allclose(res[1], expected[1], atol=tol, rtol=0)
  
imports: import autograd
  import autograd.numpy
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane import qnode
  from pennylane.devices import DefaultQubit
label_desc: Use image node_id 4 for calling the TestQNode obj's underlying member method code with example usage: obj.test_jacobian_no_evaluate(interface, dev, diff_method, grad_on_execution, tol, device_vjp) and returns: qml,  qml, autograd