code: def run_reduce(
      keep_dims,
      reduction_name,
      batch_gen,
      input_type,
      output_type=None,
      layout=None,
  ):
      batch_fn = batch_gen(input_type)
      dali_reduce_fn, numpy_reduce_fn = reduce_fns[reduction_name]
  
      for axes in batch_fn.valid_axes():
          dali_res_cpu, dali_res_gpu = run_dali(
              dali_reduce_fn,
              batch_fn,
              keep_dims=keep_dims,
              axes=axes,
              output_type=output_type,
              layout=layout,
          )
  
          batch_fn.reset()
  
          np_res = run_numpy(
              numpy_reduce_fn,
              batch_fn,
              keep_dims=keep_dims,
              axes=axes,
              output_type=output_type,
          )
  
          for iteration in range(batch_fn.num_iter()):
              compare(dali_res_cpu[iteration], np_res[iteration])
              compare(dali_res_gpu[iteration], np_res[iteration])
  
imports: import nvidia.dali.fn
  from nvidia.dali.pipeline import Pipeline
  from nose.tools import nottest
  import numpy
  from test_utils import np_type_to_dali
  from nose_utils import assert_raises
label_desc: Use image node_id 8 for calling a global function with example usage: run_reduce(keep_dims, reduction_name, batch_gen, input_type, output_type, layout) without return types