code: def roi_average_pooling_2d(
      x, rois, roi_indices, outsize, spatial_scale
  ):
      """Spatial Region of Interest (ROI) average pooling function.
  
      This function acts similarly to
      :func:`~chainer.functions.average_pooling_2d`, but it computes the average
      of input spatial patch for each channel with the region of interest.
  
      Args:
          x (~chainer.Variable): Input variable. The shape is expected to be
              4 dimensional: (n: batch, c: channel, h, height, w: width).
          rois (~chainer.Variable): Input roi variable. The shape is expected to
              be (n: data size, 4), and each datum is set as below:
              (y_min, x_min, y_max, x_max).
          roi_indices (~chainer.Variable): Input roi variable. The shape is
              expected to be (n: data size, ).
          outsize ((int, int) or int): Expected output size after pooled
              (height, width). ``outsize=o`` and ``outsize=(o, o)``
              are equivalent.
          spatial_scale (float): Scale of the roi is resized.
  
      Returns:
          ~chainer.Variable: Output variable.
  
      See the original paper proposing ROIPooling:
      `Fast R-CNN <https://arxiv.org/abs/1504.08083>`_.
  
      """
      return ROIAveragePooling2D(outsize, spatial_scale)(
          x, rois, roi_indices
      )
  
file_path: chainer/chainer/functions/pooling/roi_average_pooling_2d.py
imports: import numbers
  import numpy
  import six
  from chainer.backends import cuda
  from chainer import function
  from chainer.functions.pooling.roi_pooling_2d import _roi_pooling_slice
  from chainer import utils
  from chainer.utils import collections_abc
  from chainer.utils import type_check
label_desc: Use image node_id 2 for calling a global function with example usage: roi_average_pooling_2d(x, rois, roi_indices, outsize, spatial_scale) and returns: ROIAveragePooling2D