class_docstr: The class implements the positional-wise feed forward module in
  “Attention Is All You Need”.
  
  Arguments
  ----------
  d_ffn: int
      Hidden layer size.
  input_shape : tuple, optional
      Expected shape of the input. Alternatively use ``input_size``.
  input_size : int, optional
      Expected size of the input. Alternatively use ``input_shape``.
  dropout: float, optional
      Dropout rate.
  activation: torch.nn.Module, optional
      activation functions to be applied (Recommendation: ReLU, GELU).
  
  Example
  -------
  >>> inputs = torch.rand([8, 60, 512])
  >>> net = PositionalwiseFeedForward(256, input_size=inputs.shape[-1])
  >>> outputs = net(inputs)
  >>> outputs.shape
  torch.Size([8, 60, 512])
docstr: Applies PositionalwiseFeedForward to the input tensor x.
docstr_tok: ["Applies","PositionalwiseFeedForward","to","the","input","tensor","x","."]
code: def forward(self, x):
      """Applies PositionalwiseFeedForward to the input tensor x."""
      # give a tensor of shap (time, batch, fea)
      x = x.permute(1, 0, 2)
      x = self.ffn(x)
  
      # reshape the output back to (batch, time, fea)
      x = x.permute(1, 0, 2)
  
      return x
  
imports: import torch
  import logging
  import torch.nn
  import numpy
  from typing import Optional
  from speechbrain.dataio.dataio import length_to_mask
  import torch.nn.functional
  import math
label_desc: Use image node_id 2 for calling the PositionalwiseFeedForward obj's underlying member method code with example usage: obj.forward(x) and returns: x