code: def custom_mean(batch_norm, axes):
      bias = 0.3  # make the result purposefully slightly off
      if type(axes) is list:
          axes = tuple(axes)
      if batch_norm:
  
          def whole_batch_mean(batch):
              out = batch_mean(batch, axes) + bias
              return [out.astype(np.float32) for _ in range(len(batch))]
  
          return whole_batch_mean
      else:
  
          def per_sample_mean(batch):
              ret = [
                  x.mean(axis=axes, keepdims=True, dtype=np.float32)
                  + bias
                  for x in batch
              ]
              return ret
  
          return per_sample_mean
  
imports: from nvidia.dali.pipeline import Pipeline
  from nvidia.dali import backend
  import nvidia.dali.ops
  import numpy
  from test_utils import dali_type
  from nvidia.dali import fn, pipeline_def, types
  from nose2.tools import params
label_desc: Use image node_id 7 for calling a global function with example usage: custom_mean(batch_norm, axes) and returns: whole_batch_mean, per_sample_mean, unknown, ret