class_docstr: Transformer based encoder layer
docstr: Initialize parameters.
  
  Args:
      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",":","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,
      seq_max_len,
      embedding_dim,
      attention_dim,
      num_heads,
      conv_dims,
      dropout_rate,
  ):
      """Initialize parameters.
  
      Args:
          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(EncoderLayer, self).__init__()
  
      self.seq_max_len = seq_max_len
      self.embedding_dim = embedding_dim
  
      self.mha = MultiHeadAttention(
          attention_dim, num_heads, dropout_rate
      )
      self.ffn = PointWiseFeedForward(conv_dims, dropout_rate)
  
      self.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-6)
      self.layernorm2 = tf.keras.layers.LayerNormalization(epsilon=1e-6)
  
      self.dropout1 = tf.keras.layers.Dropout(dropout_rate)
      self.dropout2 = tf.keras.layers.Dropout(dropout_rate)
  
      self.layer_normalization = LayerNormalization(
          self.seq_max_len, self.embedding_dim, 1e-08
      )
  
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 EncoderLayer object from inherited base classes: tf.keras.layers with example: obj = EncoderLayer(seq_max_len, embedding_dim, attention_dim, num_heads, conv_dims, dropout_rate)