class_docstr: Encoder module:
  - Three 1-d convolution banks
  - Bidirectional LSTM
class_docstr_tok: ["Encoder","module",":","-","Three","1-d","convolution","banks","-","Bidirectional","LSTM"]
code: def __init__(self, hparams):
      super(Encoder, self).__init__()
  
      convolutions = []
      for _ in range(hparams.encoder_n_convolutions):
          conv_layer = nn.Sequential(
              ConvNorm(
                  hparams.encoder_embedding_dim,
                  hparams.encoder_embedding_dim,
                  kernel_size=hparams.encoder_kernel_size,
                  stride=1,
                  padding=int((hparams.encoder_kernel_size - 1) / 2),
                  dilation=1,
                  w_init_gain="relu",
              ),
              nn.BatchNorm1d(hparams.encoder_embedding_dim),
          )
          convolutions.append(conv_layer)
      self.convolutions = nn.ModuleList(convolutions)
  
      self.lstm = nn.LSTM(
          hparams.encoder_embedding_dim,
          int(hparams.encoder_embedding_dim / 2),
          1,
          batch_first=True,
          bidirectional=True,
      )
  
imports: from math import sqrt
  import torch
  import torch.distributions
  from torch.autograd import Variable
  from torch import nn
  from torch.nn import functional
  from .layers import ConvNorm, LinearNorm, GlobalAvgPool
  from .utils import to_gpu, get_mask_from_lengths
label_desc: Use image node_id 1 to create a new Encoder object from inherited base classes: nn with example: obj = Encoder(hparams)