class_docstr: Base mixin for all Pre-Normalization modules. The interface represented by this module
  is:
  
  if hidden_in is not None:
      residual_out = residual + hidden_in
  else:
      residual_out = residual
  
  hidden_out = normalize(residual_out)
  return residual_out, hidden_out
  
  Residual should be updated in-place.
class_docstr_tok: ["Base","mixin","for","all","Pre-Normalization","modules",".","The","interface","represented","by","this","module","is",":","if","hidden_in","is","not","None",":","residual_out","=","residual","+","hidden_in","else",":","residual_out","=","residual","hidden_out","=","normalize","(","residual_out",")","return","residual_out",",","hidden_out","Residual","should","be","updated","in-place","."]
docstr: Parameters:
      residual (torch.Tensor): Residual tensor.
      hidden_states (torch.Tensor): Hidden states tensor.
  
  Returns:
      (torch.Tensor, torch.Tensor): Tuple of residual and hidden states.
docstr_tok: ["Parameters",":","residual","(","torch.Tensor",")",":","Residual","tensor",".","hidden_states","(","torch.Tensor",")",":","Hidden","states","tensor",".","Returns",":","(","torch.Tensor",",","torch.Tensor",")",":","Tuple","of","residual","and","hidden","states","."]
code: def forward(
      self,
      residual: torch.Tensor,
      hidden_states: Optional[torch.Tensor],
      gamma: torch.Tensor,
      beta: Optional[torch.Tensor] = None,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """
      Parameters:
          residual (torch.Tensor): Residual tensor.
          hidden_states (torch.Tensor): Hidden states tensor.
  
      Returns:
          (torch.Tensor, torch.Tensor): Tuple of residual and hidden states.
      """
      raise NotImplementedError()
  
file_path: DeepSpeed/deepspeed/inference/v2/modules/interfaces/pre_norm_base.py
imports: from abc import abstractmethod
  from typing import Any, Dict, Optional, Tuple, Type
  import torch
  from deepspeed.runtime.config_utils import DeepSpeedConfigModel
  from ..ds_module import DSModuleBase
  from ..configs.norm_config import DSNormConfig
  from ..module_registry import DSModuleRegistryBase
  from ...inference_parameter import InferenceParameter
label_desc: Use image node_id 4 for calling the DSPreNormBase obj's underlying member method code with example usage: obj.forward(residual, hidden_states, gamma, beta) without return types