class_docstr: Tests for calling a TransformProgram on a batch of quantum tapes.
docstr: Tests postprocessing when the input is a batch and the transform outputs different sizes of batches
  for each input tape.
docstr_tok: ["Tests","postprocessing","when","the","input","is","a","batch","and","the","transform","outputs","different","sizes","of","batches","for","each","input","tape","."]
code: def test_postprocessing_batch_circuit_ragged(self):
      """Tests postprocessing when the input is a batch and the transform outputs different sizes of batches
      for each input tape.
      """
  
      # note this does not work for partitioned shots
      def sum_measurements(results: ResultBatch) -> Result:
          return sum(results)
  
      def split_sum_terms(tape):
          sum_obj = tape.measurements[0].obs
          new_tapes = tuple(
              QuantumScript(
                  tape.operations, [qml.expval(o)], shots=tape.shots
              )
              for o in sum_obj
          )
  
          return new_tapes, sum_measurements
  
      container = TransformContainer(split_sum_terms)
      prog = TransformProgram((container,))
  
      op = qml.Rot(1.2, 2.3, 3.4, wires=0)
  
      orig1 = qml.tape.QuantumScript(
          [op], [qml.expval(qml.sum(qml.PauliX(0), qml.PauliZ(0)))]
      )
      orig2 = qml.tape.QuantumScript(
          [op],
          [
              qml.expval(
                  qml.sum(qml.PauliX(0), qml.PauliY(0), qml.PauliZ(0))
              )
          ],
      )
      orig3 = qml.tape.QuantumScript(
          [op],
          [qml.expval(qml.sum(*(qml.PauliX(i) for i in range(5))))],
      )  # contributes 5 terms
  
      batch, fn = prog((orig1, orig2, orig3))
  
      assert len(batch) == 10
  
      assert fn.func is _apply_postprocessing_stack
      assert not fn.args
      fn_stack = fn.keywords["postprocessing_stack"]
      assert len(fn_stack) == 1
  
      assert fn_stack[0].func is _batch_postprocessing
      assert fn_stack[0].keywords["individual_fns"] == [
          sum_measurements,
          sum_measurements,
          sum_measurements,
      ]
      assert fn_stack[0].keywords["slices"] == [
          slice(0, 2),
          slice(2, 5),
          slice(5, 10),
      ]
  
      dummy_results = (1, 2, 3, 4, 5, 1, 1, 1, 1, 1)
      assert fn(dummy_results) == (3, 12, 5)
  
imports: from typing import Sequence, Callable
  import pytest
  import pennylane
  from pennylane.tape import QuantumScript
  from pennylane.transforms.core import transform, TransformProgram, TransformError, TransformContainer
  from pennylane.transforms.core.transform_program import _batch_postprocessing, _apply_postprocessing_stack, null_postprocessing
  from pennylane.typing import ResultBatch, Result
label_desc: Use image node_id 4 for calling the TestTransformProgramCall obj's underlying member method code with example usage: obj.test_postprocessing_batch_circuit_ragged() and returns: sum, new_tapes,  sum_measurements