class_docstr: Apply global mean and variance normalization
  
  TODO(kamo): Make this class portable somehow
  
  Args:
      stats_file: npy file
      norm_means: Apply mean normalization
      norm_vars: Apply var normalization
      eps:
class_docstr_tok: ["Apply","global","mean","and","variance","normalization","TODO","(","kamo",")",":","Make","this","class","portable","somehow","Args",":","stats_file",":","npy","file","norm_means",":","Apply","mean","normalization","norm_vars",":","Apply","var","normalization","eps",":"]
docstr: Forward function
  
  Args:
      x: (B, L, ...)
      ilens: (B,)
docstr_tok: ["Forward","function","Args",":","x",":","(","B",",","L",",","...",")","ilens",":","(","B",",",")"]
code: def forward(
      self, x: torch.Tensor, ilens: torch.Tensor = None
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """Forward function
  
      Args:
          x: (B, L, ...)
          ilens: (B,)
      """
      if ilens is None:
          ilens = x.new_full([x.size(0)], x.size(1))
      norm_means = self.norm_means
      norm_vars = self.norm_vars
      self.mean = self.mean.to(x.device, x.dtype)
      self.std = self.std.to(x.device, x.dtype)
      mask = make_pad_mask(ilens, x, 1)
  
      # feat: (B, T, D)
      if norm_means:
          if x.requires_grad:
              x = x - self.mean
          else:
              x -= self.mean
      if x.requires_grad:
          x = x.masked_fill(mask, 0.0)
      else:
          x.masked_fill_(mask, 0.0)
  
      if norm_vars:
          x /= self.std
  
      return x, ilens
  
file_path: espnet/espnet2/layers/global_mvn.py
imports: from pathlib import Path
  from typing import Tuple, Union
  import numpy
  import torch
  from typeguard import check_argument_types
  from espnet2.layers.abs_normalize import AbsNormalize
  from espnet2.layers.inversible_interface import InversibleInterface
  from espnet.nets.pytorch_backend.nets_utils import make_pad_mask
label_desc: Use image node_id 3 for calling the GlobalMVN obj's underlying member method code with example usage: obj.forward(x, ilens) and returns: x,  ilens