class_docstr: Global Layer Normalization (gLN).
class_docstr_tok: ["Global","Layer","Normalization","(","gLN",")","."]
docstr: Forward.
  
  Args:
      y: [M, N, K], M is batch size, N is channel size, K is length
  
  Returns:
      gLN_y: [M, N, K]
docstr_tok: ["Forward",".","Args",":","y",":","[","M",",","N",",","K","]",",","M","is","batch","size",",","N","is","channel","size",",","K","is","length","Returns",":","gLN_y",":","[","M",",","N",",","K","]"]
code: def forward(self, y):
      """Forward.
  
      Args:
          y: [M, N, K], M is batch size, N is channel size, K is length
  
      Returns:
          gLN_y: [M, N, K]
      """
      mean = y.mean(dim=1, keepdim=True).mean(
          dim=2, keepdim=True
      )  # [M, 1, 1]
      var = (
          (torch.pow(y - mean, 2))
          .mean(dim=1, keepdim=True)
          .mean(dim=2, keepdim=True)
      )
      gLN_y = (
          self.gamma * (y - mean) / torch.pow(var + EPS, 0.5)
          + self.beta
      )
      return gLN_y
  
imports: import torch
  import torch.nn
label_desc: Use image node_id 3 for calling the GlobalLayerNorm obj's underlying member method code with example usage: obj.forward(y) and returns: gLN_y