class_docstr: RoI average pooling over a set of 2d planes.
class_docstr_tok: ["RoI","average","pooling","over","a","set","of","2d","planes","."]
code: def backward_cpu(self, inputs, gy):
      bottom_rois, bottom_roi_indices = inputs[1:]
      channels, height, width = self._bottom_data_shape[1:]
      n_rois = bottom_rois.shape[0]
      bottom_diff = numpy.zeros(self._bottom_data_shape, gy[0].dtype)
  
      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
                  diff_val = gy[0][i_roi, :, outh, outw].reshape(
                      channels, 1, 1
                  )
                  diff_val = diff_val / lenh / lenw
                  bottom_diff[int(idx), :, sliceh, slicew] += diff_val
  
      return bottom_diff, None, None
  
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 5 for calling the ROIAveragePooling2D obj's underlying member method code with example usage: obj.backward_cpu(inputs, gy) and returns: bottom_diff,  None,  None