(tar)
return combined_mask
create look ahead mask for decode mask
create look ahead mask for decode mask
create look ahead mask for decode mask
def create_look_ahead_mask(tar):
  """
  create look ahead mask for decode mask
  """
  size = tf.shape(tar)[1]
  look_ahead_mask = 1 - tf.linalg.band_part(tf.ones((size, size)), -1, 0)
  dec_target_padding_mask = create_padding_mask(tar)
  combined_mask = tf.maximum(dec_target_padding_mask, look_ahead_mask)
  return combined_mask
def create_look_ahead_mask ( tar ) : size = tf . shape ( tar ) [ 1 ] look_ahead_mask = 1 - tf . linalg . band_part ( tf . ones ( ( size , size ) ) , - 1 , 0 ) dec_target_padding_mask = create_padding_mask ( tar ) combined_mask = tf . maximum ( dec_target_padding_mask , look_ahead_mask ) return combined_mask