class_docstr: Position Wise feed forward.
class_docstr_tok: ["Position","Wise","feed","forward","."]
code: def __init__(self, hparams=None):
      ModuleBase.__init__(self, hparams)
  
      hidden_dim = self._hparams.hidden_dim
      ffn_inner_dim = self._hparams.ffn_inner_dim
      dropout = self._hparams.dropout
      activation = self._hparams.activation
      if activation == "gelu":
          activation = layers.gelu
  
      with tf.variable_scope(self.variable_scope):
          tf.get_variable_scope().set_initializer(
              layers.get_initializer(self._hparams.initializer)
          )
          l1_hparams = {
              "type": "Dense",
              "kwargs": {
                  "units": ffn_inner_dim,
                  "activation": activation,
              },
          }
          self.linear1 = layers.get_layer(hparams=l1_hparams)
          dropout_hparams = {
              "type": "Dropout",
              "kwargs": {"rate": dropout},
          }
          self.dropout = layers.get_layer(hparams=dropout_hparams)
          l2_hparams = {
              "type": "Dense",
              "kwargs": {"units": hidden_dim},
          }
          self.linear2 = layers.get_layer(hparams=l2_hparams)
  
imports: import tensorflow
  from texar.tf.core import layers
  from texar.tf.module_base import ModuleBase
  from texar.tf.utils.mode import is_train_mode
label_desc: Use image node_id 1 to create a new PositionWiseFF object from inherited base classes: ModuleBase with example: obj = PositionWiseFF(hparams)