def call(self, input_ids: tf.Tensor=None, position_ids: tf.Tensor=None, token_type_ids: tf.Tensor=None, inputs_embeds: tf.Tensor=None, past_key_values_length=0, training: bool=False) -> tf.Tensor:
    '\n        Applies embedding based on inputs tensor.\n\n        Returns:\n            final_embeddings (`tf.Tensor`): output embedding tensor.\n        '
    if ((input_ids is None) and (inputs_embeds is None)):
        raise ValueError('Need to provide either `input_ids` or `input_embeds`.')
    if (input_ids is not None):
        inputs_embeds = tf.gather(params=self.weight, indices=input_ids)
    input_shape = shape_list(inputs_embeds)[:(- 1)]
    if (token_type_ids is None):
        token_type_ids = tf.fill(dims=input_shape, value=0)
    if (position_ids is None):
        position_ids = tf.expand_dims(tf.range(start=past_key_values_length, limit=(input_shape[1] + past_key_values_length)), axis=0)
    position_embeds = tf.gather(params=self.position_embeddings, indices=position_ids)
    token_type_embeds = tf.gather(params=self.token_type_embeddings, indices=token_type_ids)
    final_embeddings = ((inputs_embeds + position_embeds) + token_type_embeds)
    final_embeddings = self.LayerNorm(inputs=final_embeddings)
    final_embeddings = self.dropout(inputs=final_embeddings, training=training)
    return final_embeddings
Applies embedding based on inputs tensor.

Returns:
    final_embeddings (`tf.Tensor`): output embedding tensor.
def call(self, input_ids: tf.Tensor=None, position_ids: tf.Tensor=None, token_type_ids: tf.Tensor=None, inputs_embeds: tf.Tensor=None, past_key_values_length=0, training: bool=False) -> tf.Tensor:
    '\n        Applies embedding based on inputs tensor.\n\n        Returns:\n            final_embeddings (`tf.Tensor`): output embedding tensor.\n        '
    if ((input_ids is None) and (inputs_embeds is None)):
        raise ValueError('Need to provide either `input_ids` or `input_embeds`.')
    if (input_ids is not None):
        inputs_embeds = tf.gather(params=self.weight, indices=input_ids)
    input_shape = shape_list(inputs_embeds)[:(- 1)]
    if (token_type_ids is None):
        token_type_ids = tf.fill(dims=input_shape, value=0)
    if (position_ids is None):
        position_ids = tf.expand_dims(tf.range(start=past_key_values_length, limit=(input_shape[1] + past_key_values_length)), axis=0)
    position_embeds = tf.gather(params=self.position_embeddings, indices=position_ids)
    token_type_embeds = tf.gather(params=self.token_type_embeddings, indices=token_type_ids)
    final_embeddings = ((inputs_embeds + position_embeds) + token_type_embeds)
    final_embeddings = self.LayerNorm(inputs=final_embeddings)
    final_embeddings = self.dropout(inputs=final_embeddings, training=training)
    return final_embeddings