code: def mask_head_loss_post(
      segms, mask_roi_indices, gt_segms, gt_mask_labels, batchsize
  ):
      """Loss function for Mask Head (post).
  
      Args:
          segms (array): An array whose shape is :math:`(R, n\_class, M, M)`,
              where :math:`R` is the total number of RoIs in the given batch.
          mask_roi_indices (array): A list of arrays returned by
              :func:`mask_head_loss_pre`.
          gt_segms (list of arrays): A list of arrays returned by
              :func:`mask_head_loss_pre`.
          gt_mask_labels (list of arrays): A list of arrays returned by
              :func:`mask_head_loss_pre`.
          batchsize (int): The size of batch.
  
      Returns:
         chainer.Variable:
         Mask loss.
      """
      xp = cuda.get_array_module(segms.array)
  
      mask_roi_indices = xp.hstack(mask_roi_indices).astype(np.int32)
      gt_segms = xp.vstack(gt_segms)
      gt_mask_labels = xp.hstack(gt_mask_labels).astype(np.int32)
  
      mask_loss = F.sigmoid_cross_entropy(
          segms[np.arange(len(gt_mask_labels)), gt_mask_labels],
          gt_segms.astype(np.int32),
      )
      return mask_loss
  
file_path: chainercv/chainercv/links/model/fpn/mask_head.py
imports: from __future__ import division
  import numpy
  import chainer
  from chainer.backends import cuda
  import chainer.functions
  from chainer.initializers import HeNormal
  import chainer.links
  from chainercv.links import Conv2DActiv
  from chainercv.utils.bbox.bbox_iou import bbox_iou
  from chainercv.links.model.fpn.mask_utils import mask_to_segm
  from chainercv.links.model.fpn.mask_utils import segm_to_mask
label_desc: Use image node_id 2 for calling a global function with example usage: mask_head_loss_post(segms, mask_roi_indices, gt_segms, gt_mask_labels, batchsize) and returns: mask_loss