class_docstr: Mask IoU Head.
  
  This head predicts the IoU of predicted masks and corresponding gt masks.
  
  Args:
      num_convs (int): The number of convolution layers. Defaults to 4.
      num_fcs (int): The number of fully connected layers. Defaults to 2.
      roi_feat_size (int): RoI feature size. Default to 14.
      in_channels (int): The channel number of inputs features.
          Defaults to 256.
      conv_out_channels (int): The feature channels of convolution layers.
          Defaults to 256.
      fc_out_channels (int): The feature channels of fully connected layers.
          Defaults to 1024.
      num_classes (int): Number of categories excluding the background
          category. Defaults to 80.
      loss_iou (:obj:`ConfigDict` or dict): IoU loss.
      init_cfg (:obj:`ConfigDict` or dict or list[:obj:`ConfigDict` or             dict], optional): Initialization config dict.
class_docstr_tok: ["Mask","IoU","Head",".","This","head","predicts","the","IoU","of","predicted","masks","and","corresponding","gt","masks",".","Args",":","num_convs","(","int",")",":","The","number","of","convolution","layers",".","Defaults","to","4.","num_fcs","(","int",")",":","The","number","of","fully","connected","layers",".","Defaults","to","2.","roi_feat_size","(","int",")",":","RoI","feature","size",".","Default","to","14.","in_channels","(","int",")",":","The","channel","number","of","inputs","features",".","Defaults","to","256.","conv_out_channels","(","int",")",":","The","feature","channels","of","convolution","layers",".","Defaults","to","256.","fc_out_channels","(","int",")",":","The","feature","channels","of","fully","connected","layers",".","Defaults","to","1024.","num_classes","(","int",")",":","Number","of","categories","excluding","the","background","category",".","Defaults","to","80.","loss_iou","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","IoU","loss",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","dict","or","list","[",":","obj",":","`","ConfigDict","`","or","dict","]",",","optional",")",":","Initialization","config","dict","."]
docstr: Forward function.
  
  Args:
      mask_feat (Tensor): Mask features from upstream models.
      mask_preds (Tensor): Mask predictions from mask head.
  
  Returns:
      Tensor: Mask IoU predictions.
docstr_tok: ["Forward","function",".","Args",":","mask_feat","(","Tensor",")",":","Mask","features","from","upstream","models",".","mask_preds","(","Tensor",")",":","Mask","predictions","from","mask","head",".","Returns",":","Tensor",":","Mask","IoU","predictions","."]
code: def forward(self, mask_feat: Tensor, mask_preds: Tensor) -> Tensor:
      """Forward function.
  
      Args:
          mask_feat (Tensor): Mask features from upstream models.
          mask_preds (Tensor): Mask predictions from mask head.
  
      Returns:
          Tensor: Mask IoU predictions.
      """
      mask_preds = mask_preds.sigmoid()
      mask_pred_pooled = self.max_pool(mask_preds.unsqueeze(1))
  
      x = torch.cat((mask_feat, mask_pred_pooled), 1)
  
      for conv in self.convs:
          x = self.relu(conv(x))
      x = x.flatten(1)
      for fc in self.fcs:
          x = self.relu(fc(x))
      mask_iou = self.fc_mask_iou(x)
      return mask_iou
  
imports: from typing import List, Tuple
  import numpy
  import torch
  import torch.nn
  from mmcv.cnn import Conv2d, Linear, MaxPool2d
  from mmengine.config import ConfigDict
  from mmengine.model import BaseModule
  from mmengine.structures import InstanceData
  from torch import Tensor
  from torch.nn.modules.utils import _pair
  from mmdet.models.task_modules.samplers import SamplingResult
  from mmdet.registry import MODELS
  from mmdet.utils import ConfigType, InstanceList, OptMultiConfig
label_desc: Use image node_id 2 for calling the MaskIoUHead obj's underlying member method code with example usage: obj.forward(mask_feat, mask_preds) and returns: mask_iou