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"]
docstr: Forward function.
  
  Args:
      spec: (Batch, Length, Freq)
docstr_tok: ["Forward","function",".","Args",":","spec",":","(","Batch",",","Length",",","Freq",")"]
code: def forward(
      self, spec: torch.Tensor, spec_lengths: torch.Tensor = None
  ):
      """Forward function.
  
      Args:
          spec: (Batch, Length, Freq)
      """
  
      max_seq_len = spec.shape[self.dim]
      min_mask_width = math.floor(
          max_seq_len * self.mask_width_ratio_range[0]
      )
      min_mask_width = max([0, min_mask_width])
      max_mask_width = math.floor(
          max_seq_len * self.mask_width_ratio_range[1]
      )
      max_mask_width = min([max_seq_len, max_mask_width])
  
      if max_mask_width > min_mask_width:
          return mask_along_axis(
              spec,
              spec_lengths,
              mask_width_range=(min_mask_width, max_mask_width),
              dim=self.dim,
              num_mask=self.num_mask,
              replace_with_zero=self.replace_with_zero,
          )
      return spec, spec_lengths
  
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 3 for calling the MaskAlongAxisVariableMaxWidth obj's underlying member method code with example usage: obj.forward(spec, spec_lengths) and returns: spec,  spec_lengths, mask_along_axis