class_docstr: An implementation of MixFFN of PVT.
  
  The differences between MixFFN & FFN:
      1. Use 1X1 Conv to replace Linear layer.
      2. Introduce 3X3 Depth-wise Conv to encode positional information.
  
  Args:
      embed_dims (int): The feature dimension. Same as
          `MultiheadAttention`.
      feedforward_channels (int): The hidden dimension of FFNs.
      act_cfg (dict, optional): The activation config for FFNs.
          Default: dict(type='GELU').
      ffn_drop (float, optional): Probability of an element to be
          zeroed in FFN. Default 0.0.
      dropout_layer (obj:`ConfigDict`): The dropout_layer used
          when adding the shortcut.
          Default: None.
      use_conv (bool): If True, add 3x3 DWConv between two Linear layers.
          Defaults: False.
      init_cfg (obj:`mmengine.ConfigDict`): The Config for initialization.
          Default: None.
class_docstr_tok: ["An","implementation","of","MixFFN","of","PVT",".","The","differences","between","MixFFN","&","FFN",":","1",".","Use","1X1","Conv","to","replace","Linear","layer",".","2",".","Introduce","3X3","Depth-wise","Conv","to","encode","positional","information",".","Args",":","embed_dims","(","int",")",":","The","feature","dimension",".","Same","as","`","MultiheadAttention","`",".","feedforward_channels","(","int",")",":","The","hidden","dimension","of","FFNs",".","act_cfg","(","dict",",","optional",")",":","The","activation","config","for","FFNs",".","Default",":","dict","(","type='GELU","'",")",".","ffn_drop","(","float",",","optional",")",":","Probability","of","an","element","to","be","zeroed","in","FFN",".","Default","0.0.","dropout_layer","(","obj",":","`","ConfigDict","`",")",":","The","dropout_layer","used","when","adding","the","shortcut",".","Default",":","None",".","use_conv","(","bool",")",":","If","True",",","add","3x3","DWConv","between","two","Linear","layers",".","Defaults",":","False",".","init_cfg","(","obj",":","`","mmengine.ConfigDict","`",")",":","The","Config","for","initialization",".","Default",":","None","."]
code: def forward(self, x, hw_shape, identity=None):
      out = nlc_to_nchw(x, hw_shape)
      out = self.layers(out)
      out = nchw_to_nlc(out)
      if identity is None:
          identity = x
      return identity + self.dropout_layer(out)
  
imports: import math
  import warnings
  from collections import OrderedDict
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import Conv2d, build_activation_layer, build_norm_layer
  from mmcv.cnn.bricks.drop import build_dropout
  from mmcv.cnn.bricks.transformer import MultiheadAttention
  from mmengine.logging import MMLogger
  from mmengine.model import BaseModule, ModuleList, Sequential, constant_init, normal_init, trunc_normal_init
  from mmengine.model.weight_init import trunc_normal_
  from mmengine.runner.checkpoint import CheckpointLoader, load_state_dict
  from torch.nn.modules.utils import _pair
  from mmdet.registry import MODELS
  from ..layers import PatchEmbed, nchw_to_nlc, nlc_to_nchw
label_desc: Use image node_id 2 for calling the MixFFN obj's underlying member method code with example usage: obj.forward(x, hw_shape, identity) and returns: unknown