class_docstr: The Position-wise FFN layer used in Transformer-like architectures
  
  If pre_norm is True:
      norm(data) -> fc1 -> act -> act_dropout -> fc2 -> dropout -> res(+data)
  Else:
      data -> fc1 -> act -> act_dropout -> fc2 -> dropout -> norm(res(+data))
  Also, if we use gated projection. We will use
      fc1_1 * act(fc1_2(data)) to map the data
docstr: Parameters
  ----------
  data :
      Shape (B, seq_length, C_in)
  
  Returns
  -------
  out :
      Shape (B, seq_length, C_out)
docstr_tok: ["Parameters","--","--","--","--","--","data",":","Shape","(","B",",","seq_length",",","C_in",")","Returns","--","--","--","-","out",":","Shape","(","B",",","seq_length",",","C_out",")"]
code: def forward(self, data):
      """
  
      Parameters
      ----------
      data :
          Shape (B, seq_length, C_in)
  
      Returns
      -------
      out :
          Shape (B, seq_length, C_out)
      """
      residual = data
      if self._pre_norm:
          data = self.layer_norm(data)
      if self._gated_proj:
          out = self.activation(self.ffn_1_gate(data)) * self.ffn_1(
              data
          )
      else:
          out = self.activation(self.ffn_1(data))
      out = self.activation_dropout_layer(out)
      out = self.ffn_2(out)
      out = self.dropout_layer(out)
      out = out + residual
      if not self._pre_norm:
          out = self.layer_norm(out)
      return out
  
imports: import math
  from collections import OrderedDict
  import torch
  import numpy
  from torch import nn
  from typing import Union
  from .utils import to_torch_dtype
label_desc: Use image node_id 3 for calling the PositionwiseFFN obj's underlying member method code with example usage: obj.forward(data) and returns: out