class_docstr: Dynamic Mask Head for
  `Instances as Queries <http://arxiv.org/abs/2105.01928>`_
  
  Args:
      num_convs (int): Number of convolution layer.
          Defaults to 4.
      roi_feat_size (int): The output size of RoI extractor,
          Defaults to 14.
      in_channels (int): Input feature channels.
          Defaults to 256.
      conv_kernel_size (int): Kernel size of convolution layers.
          Defaults to 3.
      conv_out_channels (int): Output channels of convolution layers.
          Defaults to 256.
      num_classes (int): Number of classes.
          Defaults to 80
      class_agnostic (int): Whether generate class agnostic prediction.
          Defaults to False.
      dropout (float): Probability of drop the channel.
          Defaults to 0.0
      upsample_cfg (:obj:`ConfigDict` or dict): The config for
          upsample layer.
      conv_cfg (:obj:`ConfigDict` or dict, optional): The convolution
          layer config.
      norm_cfg (:obj:`ConfigDict` or dict, optional): The norm layer config.
      dynamic_conv_cfg (:obj:`ConfigDict` or dict): The dynamic convolution
          layer config.
      loss_mask (:obj:`ConfigDict` or dict): The config for mask loss.
class_docstr_tok: ["Dynamic","Mask","Head","for","`","Instances","as","Queries","<","http",":","\/\/arxiv.org\/abs\/2105.01928",">","`","_","Args",":","num_convs","(","int",")",":","Number","of","convolution","layer",".","Defaults","to","4.","roi_feat_size","(","int",")",":","The","output","size","of","RoI","extractor",",","Defaults","to","14.","in_channels","(","int",")",":","Input","feature","channels",".","Defaults","to","256.","conv_kernel_size","(","int",")",":","Kernel","size","of","convolution","layers",".","Defaults","to","3.","conv_out_channels","(","int",")",":","Output","channels","of","convolution","layers",".","Defaults","to","256.","num_classes","(","int",")",":","Number","of","classes",".","Defaults","to","80","class_agnostic","(","int",")",":","Whether","generate","class","agnostic","prediction",".","Defaults","to","False",".","dropout","(","float",")",":","Probability","of","drop","the","channel",".","Defaults","to","0.0","upsample_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","config","for","upsample","layer",".","conv_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","The","convolution","layer","config",".","norm_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","The","norm","layer","config",".","dynamic_conv_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","dynamic","convolution","layer","config",".","loss_mask","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","config","for","mask","loss","."]
docstr: Forward function of DynamicMaskHead.
  
  Args:
      roi_feat (Tensor): Roi-pooling features with shape
          (batch_size*num_proposals, feature_dimensions,
          pooling_h , pooling_w).
      proposal_feat (Tensor): Intermediate feature get from
          diihead in last stage, has shape
          (batch_size*num_proposals, feature_dimensions)
  
    Returns:
      mask_preds (Tensor): Predicted foreground masks with shape
      (batch_size*num_proposals, num_classes, pooling_h*2, pooling_w*2).
docstr_tok: ["Forward","function","of","DynamicMaskHead",".","Args",":","roi_feat","(","Tensor",")",":","Roi-pooling","features","with","shape","(","batch_size","*","num_proposals",",","feature_dimensions",",","pooling_h",",","pooling_w",")",".","proposal_feat","(","Tensor",")",":","Intermediate","feature","get","from","diihead","in","last","stage",",","has","shape","(","batch_size","*","num_proposals",",","feature_dimensions",")","Returns",":","mask_preds","(","Tensor",")",":","Predicted","foreground","masks","with","shape","(","batch_size","*","num_proposals",",","num_classes",",","pooling_h","*","2",",","pooling_w","*","2",")","."]
code: def forward(self, roi_feat: Tensor, proposal_feat: Tensor) -> Tensor:
      """Forward function of DynamicMaskHead.
  
      Args:
          roi_feat (Tensor): Roi-pooling features with shape
              (batch_size*num_proposals, feature_dimensions,
              pooling_h , pooling_w).
          proposal_feat (Tensor): Intermediate feature get from
              diihead in last stage, has shape
              (batch_size*num_proposals, feature_dimensions)
  
        Returns:
          mask_preds (Tensor): Predicted foreground masks with shape
          (batch_size*num_proposals, num_classes, pooling_h*2, pooling_w*2).
      """
  
      proposal_feat = proposal_feat.reshape(-1, self.in_channels)
      proposal_feat_iic = self.instance_interactive_conv(
          proposal_feat, roi_feat
      )
  
      x = proposal_feat_iic.permute(0, 2, 1).reshape(roi_feat.size())
  
      for conv in self.convs:
          x = conv(x)
      if self.upsample is not None:
          x = self.upsample(x)
          if self.upsample_method == "deconv":
              x = self.relu(x)
      mask_preds = self.conv_logits(x)
      return mask_preds
  
file_path: mmdetection/mmdet/models/roi_heads/mask_heads/dynamic_mask_head.py
imports: from typing import List
  import torch
  import torch.nn
  from mmengine.config import ConfigDict
  from torch import Tensor
  from mmdet.models.task_modules import SamplingResult
  from mmdet.registry import MODELS
  from mmdet.utils import ConfigType, InstanceList, OptConfigType, reduce_mean
  from .fcn_mask_head import FCNMaskHead
label_desc: Use image node_id 3 for calling the DynamicMaskHead obj's underlying member method code with example usage: obj.forward(roi_feat, proposal_feat) and returns: mask_preds