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_jacobian on a batch with ragged observables and parameters.
docstr_tok: ["Test","compute_jacobian","on","a","batch","with","ragged","observables","and","parameters","."]
code: def test_batch_jacobian(self, jpc, shots):
      """Test compute_jacobian 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 work with partitioned shots and multiple measurements."
          )
  
      x = np.array(0.28)
      y = np.array(1.62)
      phi = np.array(0.6293)
  
      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,
      )
  
      # note reversed order of tapes in this test
      jacs = jpc.compute_jacobian((tape2, tape1))
  
      if tape1.shots.has_partitioned_shots:
          for i in [0, 1]:
              assert qml.math.allclose(
                  jacs[0][i], -np.sin(phi), atol=_tol_for_shots(shots)
              )
              assert qml.math.allclose(
                  jacs[1][i][0][0], 0, atol=_tol_for_shots(shots)
              )
              assert qml.math.allclose(
                  jacs[1][i][0][1],
                  np.cos(y),
                  atol=_tol_for_shots(shots),
              )
              assert qml.math.allclose(
                  jacs[1][i][1][0],
                  -np.cos(x) * np.sin(y),
                  atol=_tol_for_shots(shots),
              )
              assert qml.math.allclose(
                  jacs[1][i][1][1],
                  -np.sin(x) * np.cos(y),
                  atol=_tol_for_shots(shots),
              )
      else:
          assert qml.math.allclose(
              jacs[0], -np.sin(phi), atol=_tol_for_shots(shots)
          )
          assert qml.math.allclose(
              jacs[1][0][0], 0, atol=_tol_for_shots(shots)
          )
          assert qml.math.allclose(
              jacs[1][0][1], np.cos(y), atol=_tol_for_shots(shots)
          )
          assert qml.math.allclose(
              jacs[1][1][0],
              -np.cos(x) * np.sin(y),
              atol=_tol_for_shots(shots),
          )
          assert qml.math.allclose(
              jacs[1][1][1],
              -np.sin(x) * np.cos(y),
              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 7 for calling the TestJacobianProductResults obj's underlying member method code with example usage: obj.test_batch_jacobian(jpc, shots) without return types