class_docstr: RMSNorm module definition.
  
  Reference: https://arxiv.org/pdf/1910.07467.pdf
  
  Args:
      normalized_shape: Expected size.
      eps: Value added to the denominator for numerical stability.
      partial: Value defining the part of the input used for RMS stats.
class_docstr_tok: ["RMSNorm","module","definition",".","Reference",":","https",":","\/\/arxiv.org\/pdf\/1910.07467.pdf","Args",":","normalized_shape",":","Expected","size",".","eps",":","Value","added","to","the","denominator","for","numerical","stability",".","partial",":","Value","defining","the","part","of","the","input","used","for","RMS","stats","."]
docstr: Compute RMS normalization.
  
  Args:
      x: Input sequences. (B, T, D_hidden)
  
  Returns:
      x: Output sequences. (B, T, D_hidden)
docstr_tok: ["Compute","RMS","normalization",".","Args",":","x",":","Input","sequences",".","(","B",",","T",",","D_hidden",")","Returns",":","x",":","Output","sequences",".","(","B",",","T",",","D_hidden",")"]
code: def forward(self, x: torch.Tensor) -> torch.Tensor:
      """Compute RMS normalization.
  
      Args:
          x: Input sequences. (B, T, D_hidden)
  
      Returns:
          x: Output sequences. (B, T, D_hidden)
  
      """
      if self.partial:
          partial_size = int(self.normalized_shape * self.p)
          partial_x, _ = torch.split(
              x,
              [partial_size, self.normalized_shape - partial_size],
              dim=-1,
          )
  
          norm_x = partial_x.norm(2, dim=-1, keepdim=True)
          d_x = partial_size
      else:
          norm_x = x.norm(2, dim=-1, keepdim=True)
          d_x = self.normalized_shape
  
      rms_x = norm_x * d_x ** (-1.0 / 2)
      x = self.scale * (x / (rms_x + self.eps))
  
      return x
  
file_path: espnet/espnet2/asr_transducer/normalization.py
imports: from typing import Dict, Optional, Tuple
  import torch
label_desc: Use image node_id 2 for calling the RMSNorm obj's underlying member method code with example usage: obj.forward(x) and returns: x