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])
code: def __init__(
      self,
      d_ffn,
      input_shape=None,
      input_size=None,
      dropout=0.0,
      activation=nn.ReLU,
  ):
      super().__init__()
  
      if input_shape is None and input_size is None:
          raise ValueError("Expected one of input_shape or input_size")
  
      if input_size is None:
          input_size = input_shape[-1]
  
      self.ffn = nn.Sequential(
          nn.Linear(input_size, d_ffn),
          activation(),
          nn.Dropout(dropout),
          nn.Linear(d_ffn, input_size),
      )
  
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 1 to create a new PositionalwiseFeedForward object from inherited base classes: nn with example: obj = PositionalwiseFeedForward(d_ffn, input_shape, input_size, dropout, activation)