class_docstr: Tests for integration with the PassthruQNode
class_docstr_tok: ["Tests","for","integration","with","the","PassthruQNode"]
docstr: Test that jacobian of a QNode with an attached default.qubit.autograd device
  gives the correct result with respect to the parameter-shift method
docstr_tok: ["Test","that","jacobian","of","a","QNode","with","an","attached","default.qubit.autograd","device","gives","the","correct","result","with","respect","to","the","parameter-shift","method"]
code: def test_jacobian_agrees_backprop_parameter_shift(self, tol):
      """Test that jacobian of a QNode with an attached default.qubit.autograd device
      gives the correct result with respect to the parameter-shift method
      """
      p = np.array(
          [0.43316321, 0.2162158, 0.75110998, 0.94714242],
          requires_grad=True,
      )
  
      def circuit(x):
          for i in range(0, len(p), 2):
              qml.RX(x[i], wires=0)
              qml.RY(x[i + 1], wires=1)
          for i in range(2):
              qml.CNOT(wires=[i, i + 1])
          return qml.expval(qml.PauliZ(0)), qml.var(qml.PauliZ(1))
  
      dev1 = qml.device("default.qubit.legacy", wires=3)
      dev2 = qml.device("default.qubit.legacy", wires=3)
  
      def cost(x):
          return qml.math.stack(circuit(x))
  
      circuit1 = qml.QNode(
          cost, dev1, diff_method="backprop", interface="autograd"
      )
      circuit2 = qml.QNode(cost, dev2, diff_method="parameter-shift")
  
      res = circuit1(p)
  
      assert np.allclose(res, circuit2(p), atol=tol, rtol=0)
  
      assert circuit1.gradient_fn == "backprop"
      assert circuit2.gradient_fn is qml.gradients.param_shift
  
      grad_fn = qml.jacobian(circuit1, 0)
      res = grad_fn(p)
      assert np.allclose(
          res, qml.jacobian(circuit2)(p), atol=tol, rtol=0
      )
  
imports: import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.devices.default_qubit_autograd import DefaultQubitAutograd
  from pennylane import DeviceError
label_desc: Use image node_id 5 for calling the TestPassthruIntegration obj's underlying member method code with example usage: obj.test_jacobian_agrees_backprop_parameter_shift(tol) and returns: qml,  qml, qml