class_docstr: Invokes Transformer based encoder with user defined number of layers
docstr: Initialize parameters.
  
  Args:
      num_layers (int): Number of layers.
      seq_max_len (int): Maximum sequence length.
      embedding_dim (int): Embedding dimension.
      attention_dim (int): Dimension of the attention embeddings.
      num_heads (int): Number of heads in the multi-head self-attention module.
      conv_dims (list): List of the dimensions of the Feedforward layer.
      dropout_rate (float): Dropout probability.
docstr_tok: ["Initialize","parameters",".","Args",":","num_layers","(","int",")",":","Number","of","layers",".","seq_max_len","(","int",")",":","Maximum","sequence","length",".","embedding_dim","(","int",")",":","Embedding","dimension",".","attention_dim","(","int",")",":","Dimension","of","the","attention","embeddings",".","num_heads","(","int",")",":","Number","of","heads","in","the","multi-head","self-attention","module",".","conv_dims","(","list",")",":","List","of","the","dimensions","of","the","Feedforward","layer",".","dropout_rate","(","float",")",":","Dropout","probability","."]
code: def __init__(
      self,
      num_layers,
      seq_max_len,
      embedding_dim,
      attention_dim,
      num_heads,
      conv_dims,
      dropout_rate,
  ):
      """Initialize parameters.
  
      Args:
          num_layers (int): Number of layers.
          seq_max_len (int): Maximum sequence length.
          embedding_dim (int): Embedding dimension.
          attention_dim (int): Dimension of the attention embeddings.
          num_heads (int): Number of heads in the multi-head self-attention module.
          conv_dims (list): List of the dimensions of the Feedforward layer.
          dropout_rate (float): Dropout probability.
      """
      super(Encoder, self).__init__()
  
      self.num_layers = num_layers
  
      self.enc_layers = [
          EncoderLayer(
              seq_max_len,
              embedding_dim,
              attention_dim,
              num_heads,
              conv_dims,
              dropout_rate,
          )
          for _ in range(num_layers)
      ]
  
      self.dropout = tf.keras.layers.Dropout(dropout_rate)
  
imports: import random
  import numpy
  from tqdm import tqdm
  import tensorflow
  from recommenders.utils.timer import Timer
label_desc: Use image node_id 1 to create a new Encoder object from inherited base classes: tf.keras.layers with example: obj = Encoder(num_layers, seq_max_len, embedding_dim, attention_dim, num_heads, conv_dims, dropout_rate)