class_docstr: Implements feed-forward networks (FFNs) with identity connection.
  Args:
      embed_dims (int): The feature dimension. Same as
          `MultiheadAttention`. Defaults: 256.
      feedforward_channels (int): The hidden dimension of FFNs.
          Defaults: 1024.
      num_fcs (int, optional): The number of fully-connected layers in
          FFNs. Default: 2.
      act_cfg (dict, optional): The activation config for FFNs.
          Default: dict(type='ReLU')
      ffn_drop (float, optional): Probability of an element to be
          zeroed in FFN. Default 0.0.
      add_identity (bool, optional): Whether to add the
          identity connection. Default: `True`.
      dropout_layer (obj:`ConfigDict`): The dropout_layer used
          when adding the shortcut.
      init_cfg (obj:`mmcv.ConfigDict`): The Config for initialization.
          Default: None.
class_docstr_tok: ["Implements","feed-forward","networks","(","FFNs",")","with","identity","connection",".","Args",":","embed_dims","(","int",")",":","The","feature","dimension",".","Same","as","`","MultiheadAttention","`",".","Defaults",":","256.","feedforward_channels","(","int",")",":","The","hidden","dimension","of","FFNs",".","Defaults",":","1024.","num_fcs","(","int",",","optional",")",":","The","number","of","fully-connected","layers","in","FFNs",".","Default",":","2.","act_cfg","(","dict",",","optional",")",":","The","activation","config","for","FFNs",".","Default",":","dict","(","type='ReLU","'",")","ffn_drop","(","float",",","optional",")",":","Probability","of","an","element","to","be","zeroed","in","FFN",".","Default","0.0.","add_identity","(","bool",",","optional",")",":","Whether","to","add","the","identity","connection",".","Default",":","`","True","`",".","dropout_layer","(","obj",":","`","ConfigDict","`",")",":","The","dropout_layer","used","when","adding","the","shortcut",".","init_cfg","(","obj",":","`","mmcv.ConfigDict","`",")",":","The","Config","for","initialization",".","Default",":","None","."]
docstr: Forward function for `FFN`.
  The function would add x to the output tensor if residue is None.
code: def forward(self, x, identity=None):
      """Forward function for `FFN`.
      The function would add x to the output tensor if residue is None.
      """
  
      if self.with_cp and x.requires_grad:
          out = cp.checkpoint(self.layers, x)
      else:
          out = self.layers(x)
  
      if not self.add_identity:
          return self.dropout_layer(out)
      if identity is None:
          identity = x
      return identity + self.dropout_layer(out)
  
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 FFN obj's underlying member method code with example usage: obj.forward(x, identity) and returns: unknown, self