class_docstr: Implements Dynamic Convolution.
  
  This module generate parameters for each sample and
  use bmm to implement 1*1 convolution. Code is modified
  from the `official github repo <https://github.com/PeizeSun/
  SparseR-CNN/blob/main/projects/SparseRCNN/sparsercnn/head.py#L258>`_ .
  
  Args:
      in_channels (int): The input feature channel.
          Defaults to 256.
      feat_channels (int): The inner feature channel.
          Defaults to 64.
      out_channels (int, optional): The output feature channel.
          When not specified, it will be set to `in_channels`
          by default
      input_feat_shape (int): The shape of input feature.
          Defaults to 7.
      with_proj (bool): Project two-dimentional feature to
          one-dimentional feature. Default to True.
      act_cfg (dict): The activation config for DynamicConv.
      norm_cfg (dict): Config dict for normalization layer. Default
          layer normalization.
      init_cfg (obj:`mmcv.ConfigDict`): The Config for initialization.
          Default: None.
class_docstr_tok: ["Implements","Dynamic","Convolution",".","This","module","generate","parameters","for","each","sample","and","use","bmm","to","implement","1","*","1","convolution",".","Code","is","modified","from","the","`","official","github","repo","<","https",":","\/\/github.com\/PeizeSun\/","SparseR-CNN\/blob\/main\/projects\/SparseRCNN\/sparsercnn\/head.py","#","L258",">","`","_",".","Args",":","in_channels","(","int",")",":","The","input","feature","channel",".","Defaults","to","256.","feat_channels","(","int",")",":","The","inner","feature","channel",".","Defaults","to","64.","out_channels","(","int",",","optional",")",":","The","output","feature","channel",".","When","not","specified",",","it","will","be","set","to","`","in_channels","`","by","default","input_feat_shape","(","int",")",":","The","shape","of","input","feature",".","Defaults","to","7.","with_proj","(","bool",")",":","Project","two-dimentional","feature","to","one-dimentional","feature",".","Default","to","True",".","act_cfg","(","dict",")",":","The","activation","config","for","DynamicConv",".","norm_cfg","(","dict",")",":","Config","dict","for","normalization","layer",".","Default","layer","normalization",".","init_cfg","(","obj",":","`","mmcv.ConfigDict","`",")",":","The","Config","for","initialization",".","Default",":","None","."]
docstr: Forward function for `DynamicConv`.
  
  Args:
      param_feature (Tensor): The feature can be used
          to generate the parameter, has shape
          (num_all_proposals, in_channels).
      input_feature (Tensor): Feature that
          interact with parameters, has shape
          (num_all_proposals, in_channels, H, W).
  
  Returns:
      Tensor: The output feature has shape
      (num_all_proposals, out_channels).
code: def forward(self, param_feature, input_feature):
      """Forward function for `DynamicConv`.
  
      Args:
          param_feature (Tensor): The feature can be used
              to generate the parameter, has shape
              (num_all_proposals, in_channels).
          input_feature (Tensor): Feature that
              interact with parameters, has shape
              (num_all_proposals, in_channels, H, W).
  
      Returns:
          Tensor: The output feature has shape
          (num_all_proposals, out_channels).
      """
      input_feature = input_feature.flatten(2).permute(2, 0, 1)
  
      input_feature = input_feature.permute(1, 0, 2)
      parameters = self.dynamic_layer(param_feature)
  
      param_in = parameters[:, : self.num_params_in].view(
          -1, self.in_channels, self.feat_channels
      )
      param_out = parameters[:, -self.num_params_out :].view(
          -1, self.feat_channels, self.out_channels
      )
  
      # input_feature has shape (num_all_proposals, H*W, in_channels)
      # param_in has shape (num_all_proposals, in_channels, feat_channels)
      # feature has shape (num_all_proposals, H*W, feat_channels)
      features = torch.bmm(input_feature, param_in)
      features = self.norm_in(features)
      features = self.activation(features)
  
      # param_out has shape (batch_size, feat_channels, out_channels)
      features = torch.bmm(features, param_out)
      features = self.norm_out(features)
      features = self.activation(features)
  
      if self.with_proj:
          features = features.flatten(1)
          features = self.fc_layer(features)
          features = self.fc_norm(features)
          features = self.activation(features)
  
      return features
  
imports: import math
  import warnings
  from typing import Sequence
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  from mmcv.cnn import Linear, build_activation_layer, build_norm_layer, xavier_init
  from mmcv.cnn.bricks.drop import build_dropout
  from mmcv.cnn.bricks.registry import FEEDFORWARD_NETWORK, TRANSFORMER_LAYER, TRANSFORMER_LAYER_SEQUENCE
  from mmcv.cnn.bricks.transformer import BaseTransformerLayer, TransformerLayerSequence, build_transformer_layer_sequence
  from mmcv.runner.base_module import BaseModule, Sequential
  from mmcv.utils import deprecated_api_warning, to_2tuple
  from torch.nn.init import normal_
  from ..builder import TRANSFORMER
label_desc: Use image node_id 2 for calling the DynamicConv obj's underlying member method code with example usage: obj.forward(param_feature, input_feature) and returns: features