class_docstr: Positionwise feedforward network in transformers
class_docstr_tok: ["Positionwise","feedforward","network","in","transformers"]
code: def __init__(
      self,
      d_model: int,
      d_hidden: int,
      pre_ln: bool = False,
      dropout: float = 0.0,
  ):
      super(PositionwiseFFN, self).__init__()
      self.linear1 = Linear(d_model, d_hidden)
      self.activation = nn.GELU()
      self.dropout = nn.Dropout(dropout)
      self.linear2 = Linear(d_hidden, d_model)
      self.layer_norm = nn.LayerNorm(d_model)
      self.pre_ln = pre_ln
  
file_path: gluonts/src/gluonts/nursery/daf/tslib/nn/transformer.py
imports: from typing import Optional, List
  from collections import OrderedDict
  import warnings
  import torch
  from torch import Tensor, BoolTensor
  from torch import nn
  from .attention import SelfAttention, GroupSelfAttention, CompositeAttention, InterAttention
  from .activations import Swish
label_desc: Use image node_id 1 to create a new PositionwiseFFN object from inherited base classes: nn with example: obj = PositionwiseFFN(d_model, d_hidden, pre_ln, dropout)