class_docstr: Dynamic Convolutional Module used in DMNet.
  
  Args:
      filter_size (int): The filter size of generated convolution kernel
          used in Dynamic Convolutional Module.
      fusion (bool): Add one conv to fuse DCM output feature.
      in_channels (int): Input channels.
      channels (int): Channels after modules, before conv_seg.
      conv_cfg (dict | None): Config of conv layers.
      norm_cfg (dict | None): Config of norm layers.
      act_cfg (dict): Config of activation layers.
class_docstr_tok: ["Dynamic","Convolutional","Module","used","in","DMNet",".","Args",":","filter_size","(","int",")",":","The","filter","size","of","generated","convolution","kernel","used","in","Dynamic","Convolutional","Module",".","fusion","(","bool",")",":","Add","one","conv","to","fuse","DCM","output","feature",".","in_channels","(","int",")",":","Input","channels",".","channels","(","int",")",":","Channels","after","modules",",","before","conv_seg",".","conv_cfg","(","dict","|","None",")",":","Config","of","conv","layers",".","norm_cfg","(","dict","|","None",")",":","Config","of","norm","layers",".","act_cfg","(","dict",")",":","Config","of","activation","layers","."]
docstr: Forward function.
docstr_tok: ["Forward","function","."]
code: def forward(self, x):
      """Forward function."""
      generated_filter = self.filter_gen_conv(
          F.adaptive_avg_pool2d(x, self.filter_size)
      )
      x = self.input_redu_conv(x)
      b, c, h, w = x.shape
      # [1, b * c, h, w], c = self.channels
      x = x.view(1, b * c, h, w)
      # [b * c, 1, filter_size, filter_size]
      generated_filter = generated_filter.view(
          b * c, 1, self.filter_size, self.filter_size
      )
      pad = (self.filter_size - 1) // 2
      if (self.filter_size - 1) % 2 == 0:
          p2d = (pad, pad, pad, pad)
      else:
          p2d = (pad + 1, pad, pad + 1, pad)
      x = F.pad(input=x, pad=p2d, mode="constant", value=0)
      # [1, b * c, h, w]
      output = F.conv2d(input=x, weight=generated_filter, groups=b * c)
      # [b, c, h, w]
      output = output.view(b, c, h, w)
      if self.norm is not None:
          output = self.norm(output)
      output = self.activate(output)
  
      if self.fusion:
          output = self.fusion_conv(output)
  
      return output
  
file_path: lavis/lavis/common/annotator/uniformer/mmseg/models/decode_heads/dm_head.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from annotator.uniformer.mmcv.cnn import ConvModule, build_activation_layer, build_norm_layer
  from ..builder import HEADS
  from .decode_head import BaseDecodeHead
label_desc: Use image node_id 2 for calling the DCM obj's underlying member method code with example usage: obj.forward(x) and returns: output