class_docstr: Tests for integration with the PassthruQNode
class_docstr_tok: ["Tests","for","integration","with","the","PassthruQNode"]
docstr: Tests that the gradient of the qnode is correct with batching parameters
docstr_tok: ["Tests","that","the","gradient","of","the","qnode","is","correct","with","batching","parameters"]
code: def test_batching(self, tol):
      """Tests that the gradient of the qnode is correct with batching parameters"""
      dev = qml.device("default.mixed", wires=2)
  
      @qml.batch_params
      @qml.qnode(dev, diff_method="backprop", interface="torch")
      def circuit(a, b):
          qml.RX(a, wires=0)
          qml.CRX(b, wires=[0, 1])
          return qml.expval(qml.PauliZ(0) @ qml.PauliZ(1))
  
      a = torch.tensor(
          [-0.234, 0.678], dtype=torch.float64, requires_grad=True
      )
      b = torch.tensor(
          [0.654, 1.236], dtype=torch.float64, requires_grad=True
      )
  
      res = circuit(a, b)
  
      expected_cost = 0.5 * (
          torch.cos(a) * torch.cos(b) + torch.cos(a) - torch.cos(b) + 1
      )
      assert qml.math.allclose(res, expected_cost, atol=tol, rtol=0)
  
      res_a, res_b = torch.autograd.functional.jacobian(circuit, (a, b))
      expected_a, expected_b = [
          -0.5 * torch.sin(a) * (torch.cos(b) + 1),
          0.5 * torch.sin(b) * (1 - torch.cos(a)),
      ]
  
      assert qml.math.allclose(
          torch.diagonal(res_a), expected_a, atol=tol, rtol=0
      )
      assert qml.math.allclose(
          torch.diagonal(res_b), expected_b, 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 14 for calling the TestPassthruIntegration obj's underlying member method code with example usage: obj.test_batching(tol) and returns: qml