class_docstr: YOLACT box head used in https://arxiv.org/abs/1904.02689.
  
  Note that YOLACT head is a light version of RetinaNet head.
  Four differences are described as follows:
  
  1. YOLACT box head has three-times fewer anchors.
  2. YOLACT box head shares the convs for box and cls branches.
  3. YOLACT box head uses OHEM instead of Focal loss.
  4. YOLACT box head predicts a set of mask coefficients for each box.
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      anchor_generator (:obj:`ConfigDict` or dict): Config dict for
          anchor generator
      loss_cls (:obj:`ConfigDict` or dict): Config of classification loss.
      loss_bbox (:obj:`ConfigDict` or dict): Config of localization loss.
      num_head_convs (int): Number of the conv layers shared by
          box and cls branches.
      num_protos (int): Number of the mask coefficients.
      use_ohem (bool): If true, ``loss_single_OHEM`` will be used for
          cls loss calculation. If false, ``loss_single`` will be used.
      conv_cfg (:obj:`ConfigDict` or dict, optional): Dictionary to
          construct and config conv layer.
      norm_cfg (:obj:`ConfigDict` or dict, optional): Dictionary to
          construct and config norm layer.
      init_cfg (:obj:`ConfigDict` or list[:obj:`ConfigDict`] or dict or
          list[dict], optional): Initialization config dict.
class_docstr_tok: ["YOLACT","box","head","used","in","https",":","\/\/arxiv.org\/abs\/1904.02689",".","Note","that","YOLACT","head","is","a","light","version","of","RetinaNet","head",".","Four","differences","are","described","as","follows",":","1",".","YOLACT","box","head","has","three-times","fewer","anchors",".","2",".","YOLACT","box","head","shares","the","convs","for","box","and","cls","branches",".","3",".","YOLACT","box","head","uses","OHEM","instead","of","Focal","loss",".","4",".","YOLACT","box","head","predicts","a","set","of","mask","coefficients","for","each","box",".","Args",":","num_classes","(","int",")",":","Number","of","categories","excluding","the","background","category",".","in_channels","(","int",")",":","Number","of","channels","in","the","input","feature","map",".","anchor_generator","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","dict","for","anchor","generator","loss_cls","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","classification","loss",".","loss_bbox","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","localization","loss",".","num_head_convs","(","int",")",":","Number","of","the","conv","layers","shared","by","box","and","cls","branches",".","num_protos","(","int",")",":","Number","of","the","mask","coefficients",".","use_ohem","(","bool",")",":","If","true",",","``","loss_single_OHEM","``","will","be","used","for","cls","loss","calculation",".","If","false",",","``","loss_single","``","will","be","used",".","conv_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Dictionary","to","construct","and","config","conv","layer",".","norm_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Dictionary","to","construct","and","config","norm","layer",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","list","[",":","obj",":","`","ConfigDict","`","]","or","dict","or","list","[","dict","]",",","optional",")",":","Initialization","config","dict","."]
docstr: Forward feature of a single scale level.
  
  Args:
      x (Tensor): Features of a single scale level.
  
  Returns:
      tuple:
  
      - cls_score (Tensor): Cls scores for a single scale level
        the channels number is num_anchors * num_classes.
      - bbox_pred (Tensor): Box energies / deltas for a single scale
        level, the channels number is num_anchors * 4.
      - coeff_pred (Tensor): Mask coefficients for a single scale
        level, the channels number is num_anchors * num_protos.
docstr_tok: ["Forward","feature","of","a","single","scale","level",".","Args",":","x","(","Tensor",")",":","Features","of","a","single","scale","level",".","Returns",":","tuple",":","-","cls_score","(","Tensor",")",":","Cls","scores","for","a","single","scale","level","the","channels","number","is","num_anchors","*","num_classes",".","-","bbox_pred","(","Tensor",")",":","Box","energies","\/","deltas","for","a","single","scale","level",",","the","channels","number","is","num_anchors","*","4",".","-","coeff_pred","(","Tensor",")",":","Mask","coefficients","for","a","single","scale","level",",","the","channels","number","is","num_anchors","*","num_protos","."]
code: def forward_single(self, x: Tensor) -> tuple:
      """Forward feature of a single scale level.
  
      Args:
          x (Tensor): Features of a single scale level.
  
      Returns:
          tuple:
  
          - cls_score (Tensor): Cls scores for a single scale level
            the channels number is num_anchors * num_classes.
          - bbox_pred (Tensor): Box energies / deltas for a single scale
            level, the channels number is num_anchors * 4.
          - coeff_pred (Tensor): Mask coefficients for a single scale
            level, the channels number is num_anchors * num_protos.
      """
      for head_conv in self.head_convs:
          x = head_conv(x)
      cls_score = self.conv_cls(x)
      bbox_pred = self.conv_reg(x)
      coeff_pred = self.conv_coeff(x).tanh()
      return cls_score, bbox_pred, coeff_pred
  
imports: import copy
  from typing import List, Optional
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule
  from mmengine.model import BaseModule, ModuleList
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.utils import ConfigType, InstanceList, OptConfigType, OptInstanceList, OptMultiConfig
  from ..layers import fast_nms
  from ..utils import images_to_levels, multi_apply, select_single_mlvl
  from ..utils.misc import empty_instances
  from .anchor_head import AnchorHead
  from .base_mask_head import BaseMaskHead
label_desc: Use image node_id 3 for calling the YOLACTHead obj's underlying member method code with example usage: obj.forward_single(x) and returns: cls_score,  bbox_pred,  coeff_pred