class_docstr: The whole feed-forward block. A sequence of operation. Consists of layernorm, feed-forward and residual connection.
  
  Args:
      dim_model (int): main dimension of modules in transformer blocks.
      dim_ff (int): dim_ff used in :py:class:`model_center.layer.FeedForward`.
      dtype (optional): Defaults to torch.half.
      eps (float, optional): eps used in :py:class:`model_center.layer.LayerNorm`. Defaults to 1e-5.
      dropout_p (float, optional): Defaults to 0.
class_docstr_tok: ["The","whole","feed-forward","block",".","A","sequence","of","operation",".","Consists","of","layernorm",",","feed-forward","and","residual","connection",".","Args",":","dim_model","(","int",")",":","main","dimension","of","modules","in","transformer","blocks",".","dim_ff","(","int",")",":","dim_ff","used","in",":","py",":","class",":","`","model_center.layer.FeedForward","`",".","dtype","(","optional",")",":","Defaults","to","torch.half",".","eps","(","float",",","optional",")",":","eps","used","in",":","py",":","class",":","`","model_center.layer.LayerNorm","`",".","Defaults","to","1e-5",".","dropout_p","(","float",",","optional",")",":","Defaults","to","0","."]
code: def __init__(
      self,
      dim_model: int,
      dim_ff: int,
      dtype=torch.half,
      eps: float = 1e-6,
      dropout_p: Optional[float] = 0,
  ):
      super().__init__()
  
      self.layernorm_before_ffn = LayerNorm(
          dim_model,
          dtype=dtype,
          eps=eps,
      )
  
      self.ffn = FeedForward(
          dim_model,
          dim_ff,
          dtype=dtype,
          dropout_p=dropout_p,
      )
  
      if dropout_p:
          self.dropout = torch.nn.Dropout(dropout_p)
      else:
          self.dropout = None
  
file_path: DeepKE/example/llm/CPM-Bee/src/cpm_live/native_layers/blocks.py
imports: from typing import Optional, Tuple
  import torch
  from .layernorm import LayerNorm
  from .attention import Attention
  from .feedforward import FeedForward
label_desc: Use image node_id 1 to create a new FFNBlock object from inherited base classes: torch.nn with example: obj = FFNBlock(dim_model, dim_ff, dtype, eps, dropout_p)