code: def mask_target(
      pos_proposals_list, pos_assigned_gt_inds_list, gt_masks_list, cfg
  ):
      """Compute mask target for positive proposals in multiple images.
  
      Args:
          pos_proposals_list (list[Tensor]): Positive proposals in multiple
              images, each has shape (num_pos, 4).
          pos_assigned_gt_inds_list (list[Tensor]): Assigned GT indices for each
              positive proposals, each has shape (num_pos,).
          gt_masks_list (list[:obj:`BaseInstanceMasks`]): Ground truth masks of
              each image.
          cfg (dict): Config dict that specifies the mask size.
  
      Returns:
          Tensor: Mask target of each image, has shape (num_pos, w, h).
  
      Example:
          >>> from mmengine.config import Config
          >>> import mmdet
          >>> from mmdet.data_elements.mask import BitmapMasks
          >>> from mmdet.data_elements.mask.mask_target import *
          >>> H, W = 17, 18
          >>> cfg = Config({'mask_size': (13, 14)})
          >>> rng = np.random.RandomState(0)
          >>> # Positive proposals (tl_x, tl_y, br_x, br_y) for each image
          >>> pos_proposals_list = [
          >>>     torch.Tensor([
          >>>         [ 7.2425,  5.5929, 13.9414, 14.9541],
          >>>         [ 7.3241,  3.6170, 16.3850, 15.3102],
          >>>     ]),
          >>>     torch.Tensor([
          >>>         [ 4.8448, 6.4010, 7.0314, 9.7681],
          >>>         [ 5.9790, 2.6989, 7.4416, 4.8580],
          >>>         [ 0.0000, 0.0000, 0.1398, 9.8232],
          >>>     ]),
          >>> ]
          >>> # Corresponding class index for each proposal for each image
          >>> pos_assigned_gt_inds_list = [
          >>>     torch.LongTensor([7, 0]),
          >>>     torch.LongTensor([5, 4, 1]),
          >>> ]
          >>> # Ground truth mask for each true object for each image
          >>> gt_masks_list = [
          >>>     BitmapMasks(rng.rand(8, H, W), height=H, width=W),
          >>>     BitmapMasks(rng.rand(6, H, W), height=H, width=W),
          >>> ]
          >>> mask_targets = mask_target(
          >>>     pos_proposals_list, pos_assigned_gt_inds_list,
          >>>     gt_masks_list, cfg)
          >>> assert mask_targets.shape == (5,) + cfg['mask_size']
      """
      cfg_list = [cfg for _ in range(len(pos_proposals_list))]
      mask_targets = map(
          mask_target_single,
          pos_proposals_list,
          pos_assigned_gt_inds_list,
          gt_masks_list,
          cfg_list,
      )
      mask_targets = list(mask_targets)
      if len(mask_targets) > 0:
          mask_targets = torch.cat(mask_targets)
      return mask_targets
  
imports: import numpy
  import torch
  from torch.nn.modules.utils import _pair
label_desc: Use image node_id 1 for calling a global function with example usage: mask_target(pos_proposals_list, pos_assigned_gt_inds_list, gt_masks_list, cfg) and returns: mask_targets