code: def debug_discrepancy_helper(*batch_pairs):
      """
      Accepts list of triples: left_batch, right_batch, name of a batch.
      Prepares a list of statistics for any differences between samples in the corresponding batches.
      """
  
      def as_array_list(batch):
          if isinstance(batch, tensors.TensorListGPU):
              batch = batch.as_cpu()
          return [np.array(sample) for sample in batch]
  
      batch_names = [name for _, _, name in batch_pairs]
      batch_pairs = [
          (as_array_list(left), as_array_list(right))
          for left, right, _ in batch_pairs
      ]
      batch_stats = []
      for batch_name, batch_pair in zip(batch_names, batch_pairs):
          left, right = batch_pair
          num_samples = len(left), len(right)
          sample_diffs = []
          for sample_idx, (sample_left, sample_right) in enumerate(
              zip(left, right)
          ):
              if sample_left.shape != sample_right.shape:
                  sample_diffs.append(
                      {
                          "sample_idx": sample_idx,
                          "sample_left_shape": sample_left.shape,
                          "sample_right_shape": sample_right.shape,
                      }
                  )
              else:
                  absdiff = np.maximum(
                      sample_right, sample_left
                  ) - np.minimum(sample_right, sample_left)
                  err = np.mean(absdiff)
                  max_err = np.max(absdiff)
                  min_err = np.min(absdiff)
                  total_errors = np.sum(absdiff != 0)
                  if any(
                      val != 0
                      for val in (err, max_err, max_err, total_errors)
                  ):
                      sample_diffs.append(
                          {
                              "sample_idx": sample_idx,
                              "mean_error": err,
                              "max_error": max_err,
                              "min_err": min_err,
                              "total_errors": total_errors,
                              "shape": sample_left.shape,
                          }
                      )
          batch_stats.append(
              {
                  "batch_name": batch_name,
                  "num_samples": num_samples,
                  "sample_diffs": sample_diffs,
              }
          )
      return batch_stats
  
imports: import itertools
  import os
  import random
  import unittest
  import numpy
  from scipy.stats import chisquare
  from nose2.tools import params
  from nvidia.dali import fn, tensors, types
  from nvidia.dali import pipeline_def
  from nvidia.dali.auto_aug import rand_augment
  from nvidia.dali.auto_aug.core import augmentation
  from test_utils import get_dali_extra_path, check_batch
  from nose_utils import assert_raises
label_desc: Use image node_id 1 for calling a global function with example usage: debug_discrepancy_helper() and returns: batch_stats, unknown