code: def roi_pooling_2d(x, rois, outh, outw, spatial_scale):
      """Spatial Region of Interest (ROI) pooling function.
  
      This function acts similarly to :func:`~chainer.functions.max_pooling_2d`,
      but it computes the maximum 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, 5), and each datum is set as below:
              (batch_index, x_min, y_min, x_max, y_max).
          outh (int): Height of output image after pooled.
          outw (int): Width of output image after pooled.
          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 ROIPooling2D(outh, outw, spatial_scale).apply((x, rois))[0]
  
imports: import numpy
  import six
  from chainer.backends import cuda
  from chainer import function_node
  from chainer.utils import type_check
label_desc: Use image node_id 2 for calling a global function with example usage: roi_pooling_2d(x, rois, outh, outw, spatial_scale) and returns: ROIPooling2D