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 backward_gpu(self, inputs, gy):
      utils.nondeterministic("atomicAdd")
      bottom_rois, bottom_roi_indices = inputs[1:]
      channels, height, width = self._bottom_data_shape[1:]
      bottom_diff = cuda.cupy.zeros(
          self._bottom_data_shape, bottom_rois.dtype
      )
  
      cuda.elementwise(
          """
              raw T top_diff, raw int32 argmax_data,
              raw T bottom_rois, raw int32 bottom_roi_indices, int32 num_rois,
              T spatial_scale, int32 channels, int32 height, int32 width,
              int32 pooled_height, int32 pooled_width
              """,
          "raw T bottom_diff",
          """
              int pw = i % pooled_width;
              int ph = (i / pooled_width) % pooled_height;
              int c = (i / pooled_width / pooled_height) % channels;
              int n = i / pooled_width / pooled_height / channels;
  
              int roi_batch_ind = bottom_roi_indices[n];
              int bottom_diff_offset =
                  (roi_batch_ind * channels + c) * height * width;
              int top_diff_offset =
                  (n * channels + c) * pooled_height * pooled_width;
  
              int max_index =
                  argmax_data[top_diff_offset + ph * pooled_width + pw];
              if (max_index != -1) {
                  atomicAdd(
                      &bottom_diff[bottom_diff_offset + max_index],
                      top_diff[top_diff_offset + ph * pooled_width + pw]);
              }
              """,
          "roi_max_pooling_2d_bwd",
      )(
          gy[0],
          self.argmax_data,
          bottom_rois,
          bottom_roi_indices,
          bottom_rois.shape[0],
          self.spatial_scale,
          channels,
          height,
          width,
          self.outh,
          self.outw,
          bottom_diff,
          size=gy[0].size,
      )
  
      return bottom_diff, None, None
  
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 6 for calling the ROIMaxPooling2D obj's underlying member method code with example usage: obj.backward_gpu(inputs, gy) and returns: bottom_diff,  None,  None