class_docstr: ## Feedforward Network
class_docstr_tok: ["#","#","Feedforward","Network"]
docstr: :param n_hidden: is the embedding size
code: def __init__(self, n_hidden: int = 6_144, d_ff: int = 0):
      """
      :param n_hidden: is the embedding size
      """
      super().__init__()
  
      if not d_ff:
          d_ff = n_hidden * 4
  
      # Expansion linear layer
      self.dense_h_h4 = nn.Linear(n_hidden, d_ff)
      # GELU activation
      self.activation = nn.GELU()
      # Contraction linear layer
      self.dense_h4_h = nn.Linear(d_ff, n_hidden)
  
imports: import copy
  import math
  from typing import Dict, Optional, Set, Callable, Any, Generator, Tuple
  import torch
  from torch import nn
  from torch.cuda.amp import autocast
  from labml import monit, logger
  from labml.logger import Text
  from labml_nn.neox import checkpoint
  from labml_nn.neox.utils.cache import get_cache
label_desc: Use image node_id 1 to create a new FFNLayer object from inherited base classes: nn with example: obj = FFNLayer(n_hidden, d_ff)