code: def _stage_data(i, data, ctx_list, pinned_data_stage):
      def _get_chunk(data, storage):
          s = storage.reshape(shape=(storage.size,))
          s = s[: data.size]
          s = s.reshape(shape=data.shape)
          data.copyto(s)
          return s
  
      if ctx_list[0].device_type == "cpu":
          return data
      if i not in pinned_data_stage:
          pinned_data_stage[i] = [
              d.as_in_context(mx.cpu_pinned()) for d in data
          ]
          return pinned_data_stage[i]
  
      storage = pinned_data_stage[i]
  
      for j in range(len(storage)):
          if data[j].size > storage[j].size:
              storage[j] = data[j].as_in_context(mx.cpu_pinned())
  
      return [_get_chunk(d, s) for d, s in zip(data, storage)]
  
file_path: gluon-cv/gluoncv/auto/estimators/mask_rcnn/utils.py
imports: import os
  import logging
  import mxnet
  from mxnet import gluon
  from ....None import data
  from ....data import batchify
  from ....data.sampler import SplitSortedBucketSampler
  from ....utils.metrics.coco_instance import COCOInstanceMetric
label_desc: Use image node_id 4 for calling a global function with example usage: _stage_data(i, data, ctx_list, pinned_data_stage) and returns: unknown, s, data, pinned_data_stage