class_docstr: Test first order results for the matrix of jpc options.
class_docstr_tok: ["Test","first","order","results","for","the","matrix","of","jpc","options","."]
docstr: Test compute_vjp on a batch with ragged observables and parameters.
docstr_tok: ["Test","compute_vjp","on","a","batch","with","ragged","observables","and","parameters","."]
code: def test_batch_vjp(self, jpc, shots):
      """Test compute_vjp on a batch with ragged observables and parameters."""
  
      if shots and not _accepts_finite_shots(jpc):
          pytest.skip("jpc does not work with finite shots.")
      if (
          jpc is hadamard_grad_jpc
          and qml.measurements.Shots(shots).has_partitioned_shots
      ):
          pytest.skip(
              "hadamard gradient does not support multiple measurments with partitioned shots."
          )
  
      x = 0.385
      y = 1.92
      phi = -1.05
  
      tape1 = qml.tape.QuantumScript(
          [qml.RX(x, 0), qml.RY(y, 1), qml.CNOT((0, 1))],
          [qml.expval(qml.PauliX(1)), qml.expval(qml.PauliY(0))],
          shots=shots,
      )
      tape2 = qml.tape.QuantumScript(
          [qml.Hadamard(0), qml.IsingXX(phi, wires=(0, 1))],
          [qml.expval(qml.PauliZ(1))],
          shots=shots,
      )
  
      if tape1.shots.has_partitioned_shots:
          dy1 = ((0.3, 0.2), (0.2, 0.4))
          dy2 = (0.4, 0.5)
          dy = (dy1, dy2)
      else:
          dy = ((0.5, 0.6), 0.9)
  
      vjps = jpc.compute_vjp((tape1, tape2), dy)
  
      assert qml.math.allclose(
          vjps[0][0],
          -0.6 * np.cos(x) * np.sin(y),
          atol=_tol_for_shots(shots),
      )  # dx
      assert qml.math.allclose(
          vjps[0][1],
          0.5 * np.cos(y) - 0.6 * np.sin(x) * np.cos(y),
          atol=_tol_for_shots(shots),
      )  # dy
      assert qml.math.allclose(
          vjps[1], -0.9 * np.sin(phi), atol=_tol_for_shots(shots)
      )
  
imports: import pytest
  from cachetools import LRUCache
  from param_shift_dev import ParamShiftDerivativesDevice
  import numpy
  import pennylane
  from pennylane.workflow.jacobian_products import JacobianProductCalculator, TransformJacobianProducts, DeviceDerivatives, DeviceJacobianProducts, LightningVJPs
label_desc: Use image node_id 6 for calling the TestJacobianProductResults obj's underlying member method code with example usage: obj.test_batch_vjp(jpc, shots) without return types