code: def test_roipooling_fprop_ref(
      backend_default, rois=None, inputs=None, outputs_ref=None
  ):
      if rois is None and inputs is None and outputs_ref is None:
          return
  
      (bsz, img_fm_c, img_fm_h, img_fm_w) = inputs.shape
      (rois_per_batch, _, roi_size, _) = outputs_ref.shape
      outputs_ref_in = outputs_ref.reshape(rois_per_batch, -1).T
      rois_per_image = rois_per_batch // bsz
      feature_maps = inputs.reshape(bsz, -1).T.astype(
          np.float, order="C"
      )
  
      # run the numpy roi fprop (function inside this test script)
      outputs_np = fprop_roipooling_ref(
          feature_maps,
          rois,
          img_fm_c,
          img_fm_h,
          img_fm_w,
          bsz,
          rois_per_image,
          roi_size,
          roi_size,
      )
  
      assert allclose_with_out(
          outputs_ref_in, outputs_np, atol=1e-6, rtol=0
      )
  
      # call NervanaGPU roipooling kernel
      NervanaObject.be.bsz = bsz
      be = NervanaObject.be
      input_dev = be.array(feature_maps)
      rois_dev = be.array(rois)
      output_shape = (img_fm_c, roi_size, roi_size, rois_per_batch)
      outputs_dev = be.zeros(output_shape, dtype=np.float32)
      # make sure the type being int
      argmax_dev = be.zeros(output_shape, dtype=np.int32)
  
      start_time = timeit()
      be.roipooling_fprop(
          input_dev,
          rois_dev,
          outputs_dev,
          argmax_dev,
          rois_per_batch,
          img_fm_c,
          img_fm_h,
          img_fm_w,
          roi_size,
          roi_size,
          spatial_scale,
      )
  
      outputs_backend = outputs_dev.get().reshape(-1, rois_per_batch)
  
      neon_logger.display(
          "Nervana backend roipooling fprop (sec): {}".format(
              timeit() - start_time
          )
      )
  
      assert allclose_with_out(
          outputs_ref_in, outputs_backend, atol=1e-6, rtol=0
      )
  
file_path: neon/tests/test_roipooling_layer.py
imports: from builtins import round
  import itertools
  import numpy
  from timeit import default_timer
  from neon import NervanaObject, logger
  from neon.backends import gen_backend
  from utils import allclose_with_out
label_desc: Use image node_id 6 for calling a global function with example usage: test_roipooling_fprop_ref(backend_default, rois, inputs, outputs_ref) without return types