class_docstr: Linear encoder module.
  
  Args:
      input_size: input dim
      output_size: dimension of attention
      linear_units: the number of units of position-wise feed forward
      dropout_rate: dropout rate
      input_layer: input layer type
      normalize_before: whether to use layer_norm before the first block
      padding_idx: padding_idx for input_layer=embed
code: def __init__(
      self,
      input_size: int,
      output_size: int = 256,
      dropout_rate: float = 0.1,
      input_layer: Optional[str] = "conv2d",
      normalize_before: bool = True,
      padding_idx: int = -1,
  ):
      assert check_argument_types()
      super().__init__()
      self._output_size = output_size
  
      if input_layer == "linear":
          self.embed = torch.nn.Sequential(
              torch.nn.Linear(input_size, output_size),
              torch.nn.LayerNorm(output_size),
              torch.nn.Dropout(dropout_rate),
              torch.nn.ReLU(),
          )
      elif input_layer == "conv2d":
          self.embed = Conv2dSubsampling(
              input_size, output_size, dropout_rate
          )
      elif input_layer == "conv2d2":
          self.embed = Conv2dSubsampling2(
              input_size, output_size, dropout_rate
          )
      elif input_layer == "conv2d6":
          self.embed = Conv2dSubsampling6(
              input_size, output_size, dropout_rate
          )
      elif input_layer == "conv2d8":
          self.embed = Conv2dSubsampling8(
              input_size, output_size, dropout_rate
          )
      elif input_layer == "embed":
          self.embed = (
              torch.nn.Embedding(
                  input_size, output_size, padding_idx=padding_idx
              ),
          )
      elif input_layer is None:
          if input_size == output_size:
              self.embed = None
          else:
              self.embed = torch.nn.Linear(input_size, output_size)
      else:
          raise ValueError("unknown input_layer: " + input_layer)
  
      self.normalize_before = normalize_before
      if self.normalize_before:
          self.after_norm = LayerNorm(output_size)
  
file_path: espnet/espnet2/asr/encoder/linear_encoder.py
imports: from typing import List, Optional, Tuple
  import torch
  from typeguard import check_argument_types
  from espnet2.asr.encoder.abs_encoder import AbsEncoder
  from espnet.nets.pytorch_backend.nets_utils import make_pad_mask
  from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm
  from espnet.nets.pytorch_backend.transformer.subsampling import Conv2dSubsampling, Conv2dSubsampling2, Conv2dSubsampling6, Conv2dSubsampling8, TooShortUttError, check_short_utt
label_desc: Use image node_id 1 to create a new LinearEncoder object from inherited base classes: AbsEncoder with example: obj = LinearEncoder(input_size, output_size, dropout_rate, input_layer, normalize_before, padding_idx)