class_docstr: YOLACT mask head used in https://arxiv.org/abs/1904.02689.
  
  This head outputs the mask prototypes for YOLACT.
  
  Args:
      in_channels (int): Number of channels in the input feature map.
      proto_channels (tuple[int]): Output channels of protonet convs.
      proto_kernel_sizes (tuple[int]): Kernel sizes of protonet convs.
      include_last_relu (Bool): If keep the last relu of protonet.
      num_protos (int): Number of prototypes.
      num_classes (int): Number of categories excluding the background
          category.
      loss_mask_weight (float): Reweight the mask loss by this factor.
      max_masks_to_train (int): Maximum number of masks to train for
          each image.
docstr: A helper function to take a config setting and turn it into a
  network.
docstr_tok: ["A","helper","function","to","take","a","config","setting","and","turn","it","into","a","network","."]
code: def _init_layers(self):
      """A helper function to take a config setting and turn it into a
      network."""
      # Possible patterns:
      # ( 256, 3) -> conv
      # ( 256,-2) -> deconv
      # (None,-2) -> bilinear interpolate
      in_channels = self.in_channels
      protonets = nn.ModuleList()
      for num_channels, kernel_size in zip(
          self.proto_channels, self.proto_kernel_sizes
      ):
          if kernel_size > 0:
              layer = nn.Conv2d(
                  in_channels,
                  num_channels,
                  kernel_size,
                  padding=kernel_size // 2,
              )
          else:
              if num_channels is None:
                  layer = InterpolateModule(
                      scale_factor=-kernel_size,
                      mode="bilinear",
                      align_corners=False,
                  )
              else:
                  layer = nn.ConvTranspose2d(
                      in_channels,
                      num_channels,
                      -kernel_size,
                      padding=kernel_size // 2,
                  )
          protonets.append(layer)
          protonets.append(nn.ReLU(inplace=True))
          in_channels = (
              num_channels if num_channels is not None else in_channels
          )
      if not self.include_last_relu:
          protonets = protonets[:-1]
      return nn.Sequential(*protonets)
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule, xavier_init
  from mmcv.runner import force_fp32
  from mmdet.core import build_sampler, fast_nms, images_to_levels, multi_apply
  from ..builder import HEADS, build_loss
  from .anchor_head import AnchorHead
label_desc: Use image node_id 2 for calling the YOLACTProtonet obj's underlying member method code with example usage: obj._init_layers() and returns: nn