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.mixed.torch device
  gives the correct result with respect to the parameter-shift method
docstr_tok: ["Test","that","jacobian","of","a","QNode","with","an","attached","default.mixed.torch","device","gives","the","correct","result","with","respect","to","the","parameter-shift","method"]
code: def test_backprop_jacobian_agrees_parameter_shift(self, tol):
      """Test that jacobian of a QNode with an attached default.mixed.torch device
      gives the correct result with respect to the parameter-shift method
      """
      p = pnp.array([0.43316321, 0.2162158, 0.75110998, 0.94714242])
      p_torch = torch.tensor(p, dtype=torch.float64, requires_grad=True)
      p_torch_2 = torch.tensor(
          p, dtype=torch.float64, 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.mixed", wires=3)
      dev2 = qml.device("default.mixed", wires=3)
  
      circuit1 = qml.QNode(
          circuit, dev1, diff_method="backprop", interface="torch"
      )
      circuit2 = qml.QNode(
          circuit,
          dev2,
          diff_method="parameter-shift",
          interface="torch",
      )
  
      res = circuit1(p_torch)
      assert qml.math.allclose(
          qml.math.stack(res), circuit2(p), atol=tol, rtol=0
      )
  
      assert circuit1.gradient_fn == "backprop"
      assert circuit2.gradient_fn is qml.gradients.param_shift
  
      grad = torch.autograd.functional.jacobian(circuit1, p_torch)
      grad_expected = torch.autograd.functional.jacobian(
          circuit2, p_torch_2
      )
  
      assert qml.math.allclose(
          grad[0], grad_expected[0], atol=tol, rtol=0
      )
      assert qml.math.allclose(
          grad[1], grad_expected[1], atol=tol, rtol=0
      )
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane import numpy
  from pennylane.devices.default_mixed import DefaultMixed
label_desc: Use image node_id 3 for calling the TestPassthruIntegration obj's underlying member method code with example usage: obj.test_backprop_jacobian_agrees_parameter_shift(tol) and returns: qml,  qml