code: def ps_roi_max_align_2d(
      x,
      rois,
      roi_indices,
      outsize,
      spatial_scale,
      group_size,
      sampling_ratio=None,
  ):
      """Position Sensitive Region of Interest (ROI) Max align function.
  
      This function computes position sensitive max value of input spatial patch
      with the given region of interests. Each ROI is splitted into
      :math:`(group\_size, group\_size)` regions, and position sensitive values
      in each region is computed.
  
      Args:
          x (~chainer.Variable): Input variable. The shape is expected to be
              4 dimentional: (n: batch, c: channel, h, height, w: width).
          rois (array): Input roi. The shape is expected to
              be :math:`(R, 4)`, and each datum is set as below:
              (y_min, x_min, y_max, x_max). The dtype is :obj:`numpy.float32`.
          roi_indices (array): Input roi indices. The shape is expected to
              be :math:`(R, )`. The dtype is :obj:`numpy.int32`.
          outsize ((int, int, int) or (int, int) or int): Expected output size
              after pooled: (channel, height, width) or (height, width)
              or outsize. ``outsize=o`` and ``outsize=(o, o)`` are equivalent.
              Channel parameter is used to assert the input shape.
          spatial_scale (float): Scale of the roi is resized.
          group_size (int): Position sensitive group size.
          sampling_ratio ((int, int) or int): Sampling step for the alignment.
              It must be an integer over :math:`1` or :obj:`None`, and the value
              is automatically decided when :obj:`None` is passed.  Use of
              different ratio in height and width axis is also supported by
              passing tuple of int as ``(sampling_ratio_h, sampling_ratio_w)``.
              ``sampling_ratio=s`` and ``sampling_ratio=(s, s)`` are equivalent.
  
      Returns:
          ~chainer.Variable: Output variable.
  
      See the original paper proposing PSROIPooling:
      `R-FCN <https://arxiv.org/abs/1605.06409>`_.
      See the original paper proposing ROIAlign:
      `Mask R-CNN <https://arxiv.org/abs/1703.06870>`_.
  
      """
      return PSROIMaxAlign2D(
          outsize, spatial_scale, group_size, sampling_ratio
      )(x, rois, roi_indices)
  
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_align_2d import _GET_BILINEAR_INTERP_KERNEL
  from chainercv.functions.ps_roi_average_align_2d import _get_bilinear_interp_params
  from chainercv.functions.ps_roi_average_align_2d import _get_bounds
  from chainercv.functions.ps_roi_average_align_2d import _pair
  from chainercv.functions.ps_roi_average_pooling_2d import _outsize
label_desc: Use image node_id 1 for calling a global function with example usage: ps_roi_max_align_2d(x, rois, roi_indices, outsize, spatial_scale, group_size, sampling_ratio) and returns: PSROIMaxAlign2D