class_docstr: Test that the QNode correctly changes shot value, and
  differentiates it.
class_docstr_tok: ["Test","that","the","QNode","correctly","changes","shot","value",",","and","differentiates","it","."]
docstr: Test that temporarily setting the shots works
  for gradient computations, even if the QNode has been re-evaluated
  with a different number of shots in the meantime.
docstr_tok: ["Test","that","temporarily","setting","the","shots","works","for","gradient","computations",",","even","if","the","QNode","has","been","re-evaluated","with","a","different","number","of","shots","in","the","meantime","."]
code: def test_multiple_gradient_integration(self, tol):
      """Test that temporarily setting the shots works
      for gradient computations, even if the QNode has been re-evaluated
      with a different number of shots in the meantime."""
      weights = torch.tensor([0.543, -0.654], requires_grad=True)
      a, b = weights
  
      @qnode(
          DefaultQubit(),
          interface="torch",
          diff_method=qml.gradients.param_shift,
      )
      def circuit(a, b):
          qml.RY(a, wires=0)
          qml.RX(b, wires=1)
          qml.CNOT(wires=[0, 1])
          return qml.expval(qml.PauliY(1))
  
      res1 = circuit(*weights)
      assert qml.math.shape(res1) == ()
  
      res2 = circuit(*weights, shots=[(1, 1000)])
      assert len(res2) == 1000
  
      res1.backward()
  
      expected = torch.tensor(
          [torch.sin(a) * torch.sin(b), -torch.cos(a) * torch.cos(b)]
      )
      assert torch.allclose(weights.grad, expected, atol=tol, rtol=0)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import qnode
  from pennylane.devices import DefaultQubit
label_desc: Use image node_id 3 for calling the TestShotsIntegration obj's underlying member method code with example usage: obj.test_multiple_gradient_integration(tol) and returns: qml