class_docstr: Encoder Module.
  
  Args:
      encoder_embedding_dim (int): Number of embedding dimensions in the encoder.
      encoder_n_convolution (int): Number of convolution layers in the encoder.
      encoder_kernel_size (int): The kernel size in the encoder.
  
  Examples
      >>> encoder = _Encoder(3, 512, 5)
      >>> input = torch.rand(10, 20, 30)
      >>> output = encoder(input)  # shape: (10, 30, 512)
class_docstr_tok: ["Encoder","Module",".","Args",":","encoder_embedding_dim","(","int",")",":","Number","of","embedding","dimensions","in","the","encoder",".","encoder_n_convolution","(","int",")",":","Number","of","convolution","layers","in","the","encoder",".","encoder_kernel_size","(","int",")",":","The","kernel","size","in","the","encoder",".","Examples",">",">",">","encoder","=","_Encoder","(","3",",","512",",","5",")",">",">",">","input","=","torch.rand","(","10",",","20",",","30",")",">",">",">","output","=","encoder","(","input",")","#","shape",":","(","10",",","30",",","512",")"]
code: def __init__(
      self,
      encoder_embedding_dim: int,
      encoder_n_convolution: int,
      encoder_kernel_size: int,
  ) -> None:
      super().__init__()
  
      self.convolutions = nn.ModuleList()
      for _ in range(encoder_n_convolution):
          conv_layer = nn.Sequential(
              _get_conv1d_layer(
                  encoder_embedding_dim,
                  encoder_embedding_dim,
                  kernel_size=encoder_kernel_size,
                  stride=1,
                  padding=int((encoder_kernel_size - 1) / 2),
                  dilation=1,
                  w_init_gain="relu",
              ),
              nn.BatchNorm1d(encoder_embedding_dim),
          )
          self.convolutions.append(conv_layer)
  
      self.lstm = nn.LSTM(
          encoder_embedding_dim,
          int(encoder_embedding_dim / 2),
          1,
          batch_first=True,
          bidirectional=True,
      )
      self.lstm.flatten_parameters()
  
imports: import warnings
  from typing import List, Optional, Tuple, Union
  import torch
  from torch import nn, Tensor
  from torch.nn import functional
label_desc: Use image node_id 1 to create a new _Encoder object from inherited base classes: nn with example: obj = _Encoder(encoder_embedding_dim, encoder_n_convolution, encoder_kernel_size)