class_docstr: Implements feed-forward networks (FFNs) with residual connection.
  
  Args:
      embed_dims (int): The feature dimension. Same as
          `MultiheadAttention`.
      feedforward_channels (int): The hidden dimension of FFNs.
      num_fcs (int): The number of fully-connected layers in FFNs.
      act_cfg (dict): The activation config for FFNs.
      dropout (float): Probability of an element to be zeroed. Default 0.0.
class_docstr_tok: ["Implements","feed-forward","networks","(","FFNs",")","with","residual","connection",".","Args",":","embed_dims","(","int",")",":","The","feature","dimension",".","Same","as","`","MultiheadAttention","`",".","feedforward_channels","(","int",")",":","The","hidden","dimension","of","FFNs",".","num_fcs","(","int",")",":","The","number","of","fully-connected","layers","in","FFNs",".","act_cfg","(","dict",")",":","The","activation","config","for","FFNs",".","dropout","(","float",")",":","Probability","of","an","element","to","be","zeroed",".","Default","0.0","."]
docstr: Forward function for `FFN`.
docstr_tok: ["Forward","function","for","`","FFN","`","."]
code: def forward(self, x, residual=None):
      """Forward function for `FFN`."""
      out = self.layers(x)
      if not self.add_residual:
          return out
      if residual is None:
          residual = x
      return residual + self.dropout(out)
  
imports: import torch
  import torch.nn
  from mmcv.cnn import Linear, build_activation_layer, build_norm_layer, xavier_init
  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, residual) and returns: unknown, out