src/transformers/models/xglm/modeling_tf_xglm.py/TFXGLMMainLayer/embed_positions
class TFXGLMMainLayer:    def embed_positions(
        self,
        input_ids: Optional[TFModelInputType] = None,
        inputs_embeds: Optional[Union[np.ndarray, tf.Tensor]] = None,
        past_key_values_length: Optional[int] = None,
    ) -> tf.Tensor:
        if input_ids is not None:
            position_ids = _create_position_ids_from_input_ids(input_ids, past_key_values_length, self.padding_idx)
        else:
            position_ids = _create_position_ids_from_inputs_embeds(
                inputs_embeds, past_key_values_length, self.padding_idx
            )

        positions = tf.gather(self._embed_positions_weights, position_ids, axis=0)
        return positions