code: def per_replica_to_numpy(dataset_results, num_devices):
      results = []
      for sample in dataset_results:
          new_sample = []
          for device_id in range(num_devices):
              new_batch = []
              for output in range(len(sample[0])):
                  new_batch.append(
                      sample[0][output].values[device_id].numpy()
                  )
              new_sample.append(new_batch)
          results.append(new_sample)
      return results
  
imports: import math
  import numpy
  import nvidia.dali.fn
  import nvidia.dali.plugin.tf
  import nvidia.dali.types
  import os
  import tensorflow
  from contextlib import contextmanager
  from nose import SkipTest
  from nvidia.dali.pipeline import Pipeline
  from tensorflow.python.client import device_lib
  from test_utils import to_array, get_dali_extra_path
label_desc: Use image node_id 20 for calling a global function with example usage: per_replica_to_numpy(dataset_results, num_devices) and returns: results