class_docstr: Conventional frontend structure for ASR.
  
  Stft -> WPE -> MVDR-Beamformer -> Power-spec -> Log-Mel-Fbank
class_docstr_tok: ["Conventional","frontend","structure","for","ASR",".","Stft","-",">","WPE","-",">","MVDR-Beamformer","-",">","Power-spec","-",">","Log-Mel-Fbank"]
code: def forward(
      self, input: torch.Tensor, input_lengths: torch.Tensor
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      # 1. Domain-conversion: e.g. Stft: time -> time-freq
      if self.stft is not None:
          input_stft, feats_lens = self._compute_stft(
              input, input_lengths
          )
      else:
          input_stft = ComplexTensor(input[..., 0], input[..., 1])
          feats_lens = input_lengths
      # 2. [Option] Speech enhancement
      if self.frontend is not None:
          assert isinstance(input_stft, ComplexTensor), type(input_stft)
          # input_stft: (Batch, Length, [Channel], Freq)
          input_stft, _, mask = self.frontend(input_stft, feats_lens)
  
      # 3. [Multi channel case]: Select a channel
      if input_stft.dim() == 4:
          # h: (B, T, C, F) -> h: (B, T, F)
          if self.training:
              # Select 1ch randomly
              ch = np.random.randint(input_stft.size(2))
              input_stft = input_stft[:, :, ch, :]
          else:
              # Use the first channel
              input_stft = input_stft[:, :, 0, :]
  
      # 4. STFT -> Power spectrum
      # h: ComplexTensor(B, T, F) -> torch.Tensor(B, T, F)
      input_power = input_stft.real**2 + input_stft.imag**2
  
      # 5. Feature transform e.g. Stft -> Log-Mel-Fbank
      # input_power: (Batch, [Channel,] Length, Freq)
      #       -> input_feats: (Batch, Length, Dim)
      input_feats, _ = self.logmel(input_power, feats_lens)
  
      return input_feats, feats_lens
  
file_path: espnet/espnet2/asr/frontend/default.py
imports: import copy
  from typing import Optional, Tuple, Union
  import humanfriendly
  import numpy
  import torch
  from torch_complex.tensor import ComplexTensor
  from typeguard import check_argument_types
  from espnet2.asr.frontend.abs_frontend import AbsFrontend
  from espnet2.layers.log_mel import LogMel
  from espnet2.layers.stft import Stft
  from espnet2.utils.get_default_kwargs import get_default_kwargs
  from espnet.nets.pytorch_backend.frontends.frontend import Frontend
label_desc: Use image node_id 3 for calling the DefaultFrontend obj's underlying member method code with example usage: obj.forward(input, input_lengths) and returns: input_feats,  feats_lens