class_docstr: Custom encoder module for transducer models.
  
  Args:
      idim: Input dimension.
      enc_arch: Encoder block architecture (type and parameters).
      input_layer: Input layer type.
      repeat_block: Number of times blocks_arch is repeated.
      self_attn_type: Self-attention type.
      positional_encoding_type: Positional encoding type.
      positionwise_layer_type: Positionwise layer type.
      positionwise_activation_type: Positionwise activation type.
      conv_mod_activation_type: Convolutional module activation type.
      aux_enc_output_layers: Layer IDs for auxiliary encoder output sequences.
      input_layer_dropout_rate: Dropout rate for input layer.
      input_layer_pos_enc_dropout_rate: Dropout rate for input layer pos. enc.
      padding_idx: Padding symbol ID for embedding layer.
docstr: Encode feature sequences.
  
  Args:
      feats: Feature sequences. (B, F, D_feats)
      feats_mask: Feature mask sequences. (B, 1, F)
  
  Returns:
      enc_out: Encoder output sequences. (B, T, D_enc) with/without
               Auxiliary encoder output sequences. (B, T, D_enc_aux)
      enc_out_mask: Mask for encoder output sequences. (B, 1, T) with/without
                    Mask for auxiliary encoder output sequences. (B, T, D_enc_aux)
docstr_tok: ["Encode","feature","sequences",".","Args",":","feats",":","Feature","sequences",".","(","B",",","F",",","D_feats",")","feats_mask",":","Feature","mask","sequences",".","(","B",",","1",",","F",")","Returns",":","enc_out",":","Encoder","output","sequences",".","(","B",",","T",",","D_enc",")","with\/without","Auxiliary","encoder","output","sequences",".","(","B",",","T",",","D_enc_aux",")","enc_out_mask",":","Mask","for","encoder","output","sequences",".","(","B",",","1",",","T",")","with\/without","Mask","for","auxiliary","encoder","output","sequences",".","(","B",",","T",",","D_enc_aux",")"]
code: def forward(
      self,
      feats: torch.Tensor,
      mask: torch.Tensor,
  ) -> Tuple[
      Union[
          torch.Tensor, Tuple[torch.Tensor, torch.Tensor], torch.Tensor
      ]
  ]:
      """Encode feature sequences.
  
      Args:
          feats: Feature sequences. (B, F, D_feats)
          feats_mask: Feature mask sequences. (B, 1, F)
  
      Returns:
          enc_out: Encoder output sequences. (B, T, D_enc) with/without
                   Auxiliary encoder output sequences. (B, T, D_enc_aux)
          enc_out_mask: Mask for encoder output sequences. (B, 1, T) with/without
                        Mask for auxiliary encoder output sequences. (B, T, D_enc_aux)
  
      """
      if isinstance(self.embed, (Conv2dSubsampling, VGG2L)):
          enc_out, mask = self.embed(feats, mask)
      else:
          enc_out = self.embed(feats)
  
      if self.aux_enc_output_layers:
          aux_custom_outputs = []
          aux_custom_lens = []
  
          for b in range(self.n_blocks):
              enc_out, mask = self.encoders[b](enc_out, mask)
  
              if b in self.aux_enc_output_layers:
                  if isinstance(enc_out, tuple):
                      aux_custom_output = enc_out[0]
                  else:
                      aux_custom_output = enc_out
  
                  aux_custom_outputs.append(
                      self.after_norm(aux_custom_output)
                  )
                  aux_custom_lens.append(mask)
  
      else:
          enc_out, mask = self.encoders(enc_out, mask)
  
      if isinstance(enc_out, tuple):
          enc_out = enc_out[0]
  
      enc_out = self.after_norm(enc_out)
  
      if self.aux_enc_output_layers:
          return (enc_out, aux_custom_outputs), (mask, aux_custom_lens)
  
      return enc_out, mask
  
file_path: espnet/espnet/nets/pytorch_backend/transducer/custom_encoder.py
imports: from typing import List, Tuple, Union
  import torch
  from espnet.nets.pytorch_backend.transducer.blocks import build_blocks
  from espnet.nets.pytorch_backend.transducer.vgg2l import VGG2L
  from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm
  from espnet.nets.pytorch_backend.transformer.subsampling import Conv2dSubsampling
label_desc: Use image node_id 2 for calling the CustomEncoder obj's underlying member method code with example usage: obj.forward(feats, mask) and returns: enc_out,  mask, enc_out,  aux_custom_outputs,  mask,  aux_custom_lens