class_docstr: Mask input spec along a specified axis with variable maximum width.
  
  Formula:
      max_width = max_width_ratio * seq_len
class_docstr_tok: ["Mask","input","spec","along","a","specified","axis","with","variable","maximum","width",".","Formula",":","max_width","=","max_width_ratio","*","seq_len"]
code: def __init__(
      self,
      mask_width_ratio_range: Union[float, Sequence[float]] = (
          0.0,
          0.05,
      ),
      num_mask: int = 2,
      dim: Union[int, str] = "time",
      replace_with_zero: bool = True,
  ):
      assert check_argument_types()
      if isinstance(mask_width_ratio_range, float):
          mask_width_ratio_range = (0.0, mask_width_ratio_range)
      if len(mask_width_ratio_range) != 2:
          raise TypeError(
              f"mask_width_ratio_range must be a tuple of float and float values: "
              f"{mask_width_ratio_range}",
          )
  
      assert mask_width_ratio_range[1] > mask_width_ratio_range[0]
      if isinstance(dim, str):
          if dim == "time":
              dim = 1
          elif dim == "freq":
              dim = 2
          else:
              raise ValueError("dim must be int, 'time' or 'freq'")
      if dim == 1:
          self.mask_axis = "time"
      elif dim == 2:
          self.mask_axis = "freq"
      else:
          self.mask_axis = "unknown"
  
      super().__init__()
      self.mask_width_ratio_range = mask_width_ratio_range
      self.num_mask = num_mask
      self.dim = dim
      self.replace_with_zero = replace_with_zero
  
file_path: espnet/espnet2/layers/mask_along_axis.py
imports: import math
  from typing import Sequence, Union
  import torch
  from typeguard import check_argument_types
label_desc: Use image node_id 1 to create a new MaskAlongAxisVariableMaxWidth object from inherited base classes: torch.nn with example: obj = MaskAlongAxisVariableMaxWidth(mask_width_ratio_range, num_mask, dim, replace_with_zero)