class_docstr: Transformer encoder.
  
  Encoder stack is made up of `num_layers` identical encoder layers.
  
  Arguments:
      num_layers: Positive integer, number of encoder layers.
      units: Positive integer, output dim of hidden layer.
      num_heads: Positive integer, number of heads
          to repeat the same attention structure.
      filter_units: Positive integer, output dim of the first ffn hidden layer.
      reg_lambda: Float, regularization factor.
      dropout_rate: Float between 0 and 1; fraction of the input units to drop.
      attention_dropout_rate: Float, dropout rate inside attention for training.
      density: Approximate fraction of trainable weights (in
          `RandomlyConnectedDense` layers).
      unidirectional: Boolean, use a unidirectional or bidirectional encoder.
      use_key_relative_position: Boolean, if 'True' use key
          relative embeddings in attention.
      use_value_relative_position: Boolean, if 'True' use value
          relative embeddings in attention.
      max_relative_position: Positive integer, max position for relative embeddings.
      heads_share_relative_embedding: Boolean, if 'True'
          heads will share relative embeddings.
      name: Optional name of the layer.
class_docstr_tok: ["Transformer","encoder",".","Encoder","stack","is","made","up","of","`","num_layers","`","identical","encoder","layers",".","Arguments",":","num_layers",":","Positive","integer",",","number","of","encoder","layers",".","units",":","Positive","integer",",","output","dim","of","hidden","layer",".","num_heads",":","Positive","integer",",","number","of","heads","to","repeat","the","same","attention","structure",".","filter_units",":","Positive","integer",",","output","dim","of","the","first","ffn","hidden","layer",".","reg_lambda",":","Float",",","regularization","factor",".","dropout_rate",":","Float","between","0","and","1",";","fraction","of","the","input","units","to","drop",".","attention_dropout_rate",":","Float",",","dropout","rate","inside","attention","for","training",".","density",":","Approximate","fraction","of","trainable","weights","(","in","`","RandomlyConnectedDense","`","layers",")",".","unidirectional",":","Boolean",",","use","a","unidirectional","or","bidirectional","encoder",".","use_key_relative_position",":","Boolean",",","if","'True","'","use","key","relative","embeddings","in","attention",".","use_value_relative_position",":","Boolean",",","if","'True","'","use","value","relative","embeddings","in","attention",".","max_relative_position",":","Positive","integer",",","max","position","for","relative","embeddings",".","heads_share_relative_embedding",":","Boolean",",","if","'True'","heads","will","share","relative","embeddings",".","name",":","Optional","name","of","the","layer","."]
code: def _look_ahead_pad_mask(max_position: tf.Tensor) -> tf.Tensor:
      pad_mask = 1 - tf.linalg.band_part(
          tf.ones((max_position, max_position)), -1, 0
      )
      return pad_mask[tf.newaxis, tf.newaxis, :, :]
  
imports: from typing import Optional, Text, Tuple, Union
  import numpy
  import tensorflow
  from keras.utils.control_flow_util import smart_cond
  from tensorflow.keras import backend
  import rasa.shared.utils.cli
  from rasa.utils.tensorflow.layers import RandomlyConnectedDense
label_desc: Use image node_id 4 for calling the TransformerEncoder obj's underlying member method code with example usage: obj._look_ahead_pad_mask(max_position) and returns: pad_mask