class_docstr: RoI max pooling over a set of 2d planes.
class_docstr_tok: ["RoI","max","pooling","over","a","set","of","2d","planes","."]
code: def forward_cpu(self, inputs):
      self.retain_inputs((1, 2))
      self._bottom_data_shape = inputs[0].shape
  
      bottom_data, bottom_rois, bottom_roi_indices = inputs
      channels, height, width = bottom_data.shape[1:]
      n_rois = bottom_rois.shape[0]
      top_data = numpy.full(
          (n_rois, channels, self.outh, self.outw),
          -numpy.inf,
          dtype=bottom_data.dtype,
      )
      self.argmax_data = -numpy.ones(top_data.shape, numpy.int32)
  
      for i_roi in six.moves.range(n_rois):
          idx = bottom_roi_indices[i_roi]
          ymin, xmin, ymax, xmax = bottom_rois[i_roi]
          ymin = int(round(ymin * self.spatial_scale))
          xmin = int(round(xmin * self.spatial_scale))
          ymax = int(round(ymax * self.spatial_scale))
          xmax = int(round(xmax * self.spatial_scale))
          roi_height = max(ymax - ymin, 1)
          roi_width = max(xmax - xmin, 1)
          strideh = 1.0 * roi_height / self.outh
          stridew = 1.0 * roi_width / self.outw
  
          for outh in six.moves.range(self.outh):
              sliceh, lenh = _roi_pooling_slice(
                  outh, strideh, height, ymin
              )
              if sliceh.stop <= sliceh.start:
                  continue
              for outw in six.moves.range(self.outw):
                  slicew, lenw = _roi_pooling_slice(
                      outw, stridew, width, xmin
                  )
                  if slicew.stop <= slicew.start:
                      continue
                  roi_data = bottom_data[
                      int(idx), :, sliceh, slicew
                  ].reshape(channels, -1)
                  top_data[i_roi, :, outh, outw] = numpy.max(
                      roi_data, axis=1
                  )
  
                  # get the max idx respect to feature_maps coordinates
                  max_idx_slice = numpy.unravel_index(
                      numpy.argmax(roi_data, axis=1), (lenh, lenw)
                  )
                  max_idx_slice_h = max_idx_slice[0] + sliceh.start
                  max_idx_slice_w = max_idx_slice[1] + slicew.start
                  max_idx_slice = (
                      max_idx_slice_h * width + max_idx_slice_w
                  )
                  self.argmax_data[i_roi, :, outh, outw] = max_idx_slice
      return (top_data,)
  
file_path: chainer/chainer/functions/pooling/roi_max_pooling_2d.py
imports: import numbers
  import numpy
  import six
  import chainer
  from chainer.backends import cuda
  from chainer import function
  from chainer import utils
  from chainer.utils import type_check
  from chainer.functions.pooling.roi_pooling_2d import _roi_pooling_slice
label_desc: Use image node_id 3 for calling the ROIMaxPooling2D obj's underlying member method code with example usage: obj.forward_cpu(inputs) and returns: top_data