code: def batch_to_numpy(
      batch,
      error_str="Unsupported callback return type. Got: `{}`.",
      non_uniform_str="Uniform input is required (batch of tensors of equal shapes), got {}.",
  ):
      import_numpy()
      assert_cpu_batch_data_type(batch, error_str)
      if isinstance(batch, tensors.TensorListCPU):
          if not batch.is_dense_tensor():
              raise ValueError(non_uniform_str.format(batch))
          return batch.as_array()
      elif isinstance(batch, list):
          result = [
              sample_to_numpy(sample, error_str) for sample in batch
          ]
          first_shape = result[0].shape
          for sample in result:
              if first_shape != sample.shape:
                  raise ValueError(non_uniform_str.format(batch))
          return np.stack(result)
      else:
          return sample_to_numpy(batch, error_str)
  
imports: from enum import Enum
  from nvidia.dali import types
  from nvidia.dali import tensors
  import inspect
  import functools
label_desc: Use image node_id 5 for calling a global function with example usage: batch_to_numpy(batch, error_str, non_uniform_str) and returns: batch, np, sample_to_numpy