class_docstr: Encoder module.
  
  Args:
      idim: Input dimension.
      etype: Encoder units type.
      elayers: Number of encoder layers.
      eunits: Number of encoder units per layer.
      eprojs: Number of projection units per layer.
      subsample: Subsampling rate per layer.
      dropout_rate: Dropout rate for encoder layers.
      intermediate_encoder_layers: Layer IDs for auxiliary encoder output sequences.
class_docstr_tok: ["Encoder","module",".","Args",":","idim",":","Input","dimension",".","etype",":","Encoder","units","type",".","elayers",":","Number","of","encoder","layers",".","eunits",":","Number","of","encoder","units","per","layer",".","eprojs",":","Number","of","projection","units","per","layer",".","subsample",":","Subsampling","rate","per","layer",".","dropout_rate",":","Dropout","rate","for","encoder","layers",".","intermediate_encoder_layers",":","Layer","IDs","for","auxiliary","encoder","output","sequences","."]
docstr: Initialize Encoder module.
docstr_tok: ["Initialize","Encoder","module","."]
code: def __init__(
      self,
      idim: int,
      etype: str,
      elayers: int,
      eunits: int,
      eprojs: int,
      subsample: np.ndarray,
      dropout_rate: float = 0.0,
      aux_enc_output_layers: List = [],
  ):
      """Initialize Encoder module."""
      super(Encoder, self).__init__()
  
      rnn_type = etype.lstrip("vgg").rstrip("p")
      in_channel = 1
  
      if etype.startswith("vgg"):
          if etype[-1] == "p":
              self.enc = torch.nn.ModuleList(
                  [
                      VGG2L(in_channel),
                      RNNP(
                          get_vgg2l_odim(idim, in_channel=in_channel),
                          rnn_type,
                          elayers,
                          eunits,
                          eprojs,
                          subsample,
                          dropout_rate=dropout_rate,
                          aux_output_layers=aux_enc_output_layers,
                      ),
                  ]
              )
          else:
              self.enc = torch.nn.ModuleList(
                  [
                      VGG2L(in_channel),
                      RNN(
                          get_vgg2l_odim(idim, in_channel=in_channel),
                          rnn_type,
                          elayers,
                          eunits,
                          eprojs,
                          dropout_rate=dropout_rate,
                          aux_output_layers=aux_enc_output_layers,
                      ),
                  ]
              )
          self.conv_subsampling_factor = 4
      else:
          if etype[-1] == "p":
              self.enc = torch.nn.ModuleList(
                  [
                      RNNP(
                          idim,
                          rnn_type,
                          elayers,
                          eunits,
                          eprojs,
                          subsample,
                          dropout_rate=dropout_rate,
                          aux_output_layers=aux_enc_output_layers,
                      )
                  ]
              )
          else:
              self.enc = torch.nn.ModuleList(
                  [
                      RNN(
                          idim,
                          rnn_type,
                          elayers,
                          eunits,
                          eprojs,
                          dropout_rate=dropout_rate,
                          aux_output_layers=aux_enc_output_layers,
                      )
                  ]
              )
          self.conv_subsampling_factor = 1
  
imports: from argparse import Namespace
  from typing import List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.nn.functional
  from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
  from espnet.nets.e2e_asr_common import get_vgg2l_odim
  from espnet.nets.pytorch_backend.nets_utils import make_pad_mask, to_device
label_desc: Use image node_id 1 to create a new Encoder object from inherited base classes: torch.nn with example: obj = Encoder(idim, etype, elayers, eunits, eprojs, subsample, dropout_rate, aux_enc_output_layers)