class_docstr: Test gradients for multiple measurements
class_docstr_tok: ["Test","gradients","for","multiple","measurements"]
docstr: Test derivatives when using autograd
docstr_tok: ["Test","derivatives","when","using","autograd"]
code: def test_autograd(self, diff_method, tol):
      """Test derivatives when using autograd"""
      dev = qml.device("default.qubit", wires=2)
  
      @partial(qml.batch_input, argnum=0)
      @qml.qnode(dev, diff_method=diff_method)
      def circuit(input, x):
          qml.RY(input, wires=0)
          qml.RY(x, wires=0)
          qml.CNOT(wires=[0, 1])
          return qml.expval(qml.PauliZ(0)), qml.probs(wires=[0, 1])
  
      def cost(input, x):
          res = circuit(input, x)
          return qml.math.concatenate(
              [qml.math.expand_dims(res[0], 1), res[1]], axis=1
          )
  
      batch_size = 3
      input = np.linspace(0.1, 0.5, batch_size, requires_grad=False)
      x = np.array(0.1, requires_grad=True)
  
      res = cost(input, x)
      expected = qml.math.transpose(
          qml.math.stack(
              [
                  np.cos(input + x),
                  np.cos((input + x) / 2) ** 2,
                  np.zeros_like(input),
                  np.zeros_like(input),
                  np.sin((input + x) / 2) ** 2,
              ]
          )
      )
      assert qml.math.allclose(res, expected, atol=tol)
  
      grad = qml.jacobian(lambda x: cost(input, x))(x)
      expected = qml.math.transpose(
          qml.math.stack(
              [
                  -np.sin(input + x),
                  -np.sin(input + x) / 2,
                  np.zeros_like(input),
                  np.zeros_like(input),
                  np.sin(input + x) / 2,
              ]
          )
      )
      assert qml.math.allclose(grad, expected, atol=tol, rtol=0)
  
imports: from functools import partial
  import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 1 for calling the TestDiffMulti obj's underlying member method code with example usage: obj.test_autograd(diff_method, tol) and returns: qml,  qml, qml