docstr: Tacotron 2 Encoder. A number of convolution layers that feed into a LSTM
  
  Args:
      encoder_n_convolutions (int): Number of convolution layers.
      encoder_embedding_dim (int): Final output embedding size. Also used to create the convolution and LSTM layers.
      encoder_kernel_size (int): Kernel of the convolution front-end.
docstr_tok: ["Tacotron","2","Encoder",".","A","number","of","convolution","layers","that","feed","into","a","LSTM","Args",":","encoder_n_convolutions","(","int",")",":","Number","of","convolution","layers",".","encoder_embedding_dim","(","int",")",":","Final","output","embedding","size",".","Also","used","to","create","the","convolution","and","LSTM","layers",".","encoder_kernel_size","(","int",")",":","Kernel","of","the","convolution","front-end","."]
code: def __init__(
      self,
      encoder_n_convolutions: int,
      encoder_embedding_dim: int,
      encoder_kernel_size: int,
  ):
      """
      Tacotron 2 Encoder. A number of convolution layers that feed into a LSTM
  
      Args:
          encoder_n_convolutions (int): Number of convolution layers.
          encoder_embedding_dim (int): Final output embedding size. Also used to create the convolution and LSTM layers.
          encoder_kernel_size (int): Kernel of the convolution front-end.
      """
      super().__init__()
  
      convolutions = []
      for _ in range(encoder_n_convolutions):
          conv_layer = torch.nn.Sequential(
              ConvNorm(
                  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",
              ),
              torch.nn.BatchNorm1d(encoder_embedding_dim),
          )
          convolutions.append(conv_layer)
      self.convolutions = torch.nn.ModuleList(convolutions)
  
      self.lstm = torch.nn.LSTM(
          encoder_embedding_dim,
          int(encoder_embedding_dim / 2),
          1,
          batch_first=True,
          bidirectional=True,
      )
  
imports: import torch
  from torch.autograd import Variable
  from torch.nn import functional
  from nemo.collections.tts.modules.submodules import Attention, ConvNorm, LinearNorm, Prenet
  from nemo.collections.tts.parts.utils.helpers import get_mask_from_lengths
  from nemo.core.classes import NeuralModule, typecheck
  from nemo.core.neural_types.elements import EmbeddedTextType, LengthsType, LogitsType, MelSpectrogramType, SequenceToSequenceAlignmentType
  from nemo.core.neural_types.neural_type import NeuralType
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new Encoder object from inherited base classes: NeuralModule with example: obj = Encoder(encoder_n_convolutions, encoder_embedding_dim, encoder_kernel_size)