class_docstr: Tests that ensure various qubit circuits integrate correctly
class_docstr_tok: ["Tests","that","ensure","various","qubit","circuits","integrate","correctly"]
docstr: Tests correct output shape and evaluation for a tape
  with prob and expval outputs
docstr_tok: ["Tests","correct","output","shape","and","evaluation","for","a","tape","with","prob","and","expval","outputs"]
code: def test_ragged_differentiation(
      self,
      interface,
      dev,
      diff_method,
      grad_on_execution,
      device_vjp,
      tol,
  ):
      """Tests correct output shape and evaluation for a tape
      with prob and expval outputs"""
      if "lightning" in getattr(dev, "short_name", ""):
          pytest.xfail(
              "lightning does not support measuring probabilities with adjoint."
          )
  
      kwargs = dict(
          diff_method=diff_method,
          interface=interface,
          grad_on_execution=grad_on_execution,
          device_vjp=device_vjp,
      )
  
      if diff_method == "spsa":
          kwargs["sampler_rng"] = np.random.default_rng(SEED_FOR_SPSA)
          tol = TOL_FOR_SPSA
  
      x = np.array(0.543, requires_grad=True)
      y = np.array(-0.654, requires_grad=True)
  
      @qnode(dev, **kwargs)
      def circuit(x, y):
          qml.RX(x, wires=[0])
          qml.RY(y, wires=[1])
          qml.CNOT(wires=[0, 1])
          return qml.expval(qml.PauliZ(0)), qml.probs(wires=[1])
  
      res = circuit(x, y)
      assert isinstance(res, tuple)
      expected = [
          np.cos(x),
          [
              (1 + np.cos(x) * np.cos(y)) / 2,
              (1 - np.cos(x) * np.cos(y)) / 2,
          ],
      ]
      assert np.allclose(res[0], expected[0], atol=tol, rtol=0)
      assert np.allclose(res[1], expected[1], atol=tol, rtol=0)
  
      def cost(x, y):
          return autograd.numpy.hstack(circuit(x, y))
  
      res = qml.jacobian(cost)(x, y)
      assert isinstance(res, tuple)
      assert len(res) == 2
  
      assert res[0].shape == (3,)
      assert res[1].shape == (3,)
  
      expected = (
          np.array(
              [
                  -np.sin(x),
                  -np.sin(x) * np.cos(y) / 2,
                  np.sin(x) * np.cos(y) / 2,
              ]
          ),
          np.array(
              [0, -np.cos(x) * np.sin(y) / 2, np.cos(x) * np.sin(y) / 2]
          ),
      )
      assert np.allclose(res[0], expected[0], atol=tol, rtol=0)
      assert np.allclose(res[1], expected[1], atol=tol, rtol=0)
  
imports: import autograd
  import autograd.numpy
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane import qnode
  from pennylane.devices import DefaultQubit
label_desc: Use image node_id 3 for calling the TestQubitIntegration obj's underlying member method code with example usage: obj.test_ragged_differentiation(interface, dev, diff_method, grad_on_execution, device_vjp, tol) and returns: qml,  qml, autograd