code: def __init__(
      self,
      num_layers: int,
      num_heads: int,
      feed_forward_dim: int,
      embedding_shape: Tuple[int, int],
      embedding_trainable=True,
      embedding_weights=None,
      dropout_rate=0.1,
      max_seq_len=10000,
  ) -> None:
      super(Encoder, self).__init__()
  
      self.num_layers = num_layers
      vocab_size, vec_dim = embedding_shape
      weights = (
          None if embedding_weights is None else [embedding_weights]
      )
      self.embedding_size = vec_dim
      self.embedding = tf.keras.layers.Embedding(
          vocab_size,
          vec_dim,
          weights=weights,
          trainable=embedding_trainable,
      )
      self.pos_encoding = positional_encoding(
          max_seq_len, self.embedding_size
      )
      self.enc_layers = [
          EncoderLayer(
              vec_dim, num_heads, feed_forward_dim, dropout_rate
          )
          for _ in range(num_layers)
      ]
      self.dropout = tf.keras.layers.Dropout(dropout_rate)
  
file_path: headliner/headliner/model/transformer_model.py
imports: from typing import Tuple
  from headliner.model.transformer_util import *
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, num_heads, feed_forward_dim, embedding_shape, embedding_trainable, embedding_weights, dropout_rate, max_seq_len)