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","."]
docstr: Args:
      hidden_states (:obj:`torch.Tensor` of shape ``(batch, seq_self, dim_model)``): Hidden states before feed forward layer.
  
  Return:
      :obj:`torch.Tensor` of shape ``(batch, seq_self, dim_model)``: The output of feed-forward block
docstr_tok: ["Args",":","hidden_states","(",":","obj",":","`","torch.Tensor","`","of","shape","``","(","batch",",","seq_self",",","dim_model",")","``",")",":","Hidden","states","before","feed","forward","layer",".","Return",":",":","obj",":","`","torch.Tensor","`","of","shape","``","(","batch",",","seq_self",",","dim_model",")","``",":","The","output","of","feed-forward","block"]
code: def forward(
      self,
      hidden_states: torch.Tensor,
  ):
      """
      Args:
          hidden_states (:obj:`torch.Tensor` of shape ``(batch, seq_self, dim_model)``): Hidden states before feed forward layer.
  
      Return:
          :obj:`torch.Tensor` of shape ``(batch, seq_self, dim_model)``: The output of feed-forward block
  
      """  # noqa: E501
      x = self.layernorm_before_ffn(hidden_states)
      x = self.ffn(x)
      if self.dropout is not None:
          x = self.dropout(x)
      hidden_states = (hidden_states + x) / 1.05
      return hidden_states
  
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 2 for calling the FFNBlock obj's underlying member method code with example usage: obj.forward(hidden_states) and returns: hidden_states