code: def backward_cpu(self, inputs, gy):
      _, bottom_rois, bottom_roi_indices = inputs
      top_diff = gy[0]
      height, width = self._bottom_data_shape[2:]
      bottom_diff = np.zeros(self._bottom_data_shape, np.float32)
  
      spatial_scale = self.spatial_scale
      pooled_height = self.out_h
      pooled_width = self.out_w
      group_size = self.group_size
  
      for i in six.moves.range(top_diff.size):
          n, ctop, ph, pw = np.unravel_index(i, top_diff.shape)
  
          roi_batch_ind = int(bottom_roi_indices[n])
          roi_start_h = bottom_rois[n, 0] * spatial_scale
          roi_start_w = bottom_rois[n, 1] * spatial_scale
          roi_end_h = bottom_rois[n, 2] * spatial_scale
          roi_end_w = bottom_rois[n, 3] * spatial_scale
  
          roi_height = max(roi_end_h - roi_start_h, 0.1)
          roi_width = max(roi_end_w - roi_start_w, 0.1)
          bin_size_h = roi_height / pooled_height
          bin_size_w = roi_width / pooled_width
  
          hstart = int(np.floor(ph * bin_size_h + roi_start_h))
          wstart = int(np.floor(pw * bin_size_w + roi_start_w))
          hend = int(np.ceil((ph + 1) * bin_size_h + roi_start_h))
          wend = int(np.ceil((pw + 1) * bin_size_w + roi_start_w))
          hstart = min(max(hstart, 0), height)
          wstart = min(max(wstart, 0), width)
          hend = min(max(hend, 0), height)
          wend = min(max(wend, 0), width)
  
          gh = int(np.floor(ph * group_size / pooled_height))
          gw = int(np.floor(pw * group_size / pooled_width))
          gh = min(max(gh, 0), group_size - 1)
          gw = min(max(gw, 0), group_size - 1)
          c = (ctop * group_size + gh) * group_size + gw
  
          maxidx = self.argmax_data[n, ctop, ph, pw]
          if maxidx != -1:
              y = int(maxidx / width)
              x = maxidx % width
              bottom_diff[roi_batch_ind, c, y, x] += top_diff[
                  n, ctop, ph, pw
              ]
  
      return bottom_diff, None, None
  
file_path: chainercv/chainercv/functions/ps_roi_max_pooling_2d.py
imports: from __future__ import division
  import numbers
  import numpy
  import six
  from chainer.backends import cuda
  from chainer import function
  from chainer.utils import type_check
  from chainercv.functions.ps_roi_average_pooling_2d import _outsize
label_desc: Use image node_id 5 for calling the PSROIMaxPooling2D obj's underlying member method code with example usage: obj.backward_cpu(inputs, gy) and returns: bottom_diff,  None,  None