Implement a function add_positional_embeddings(token_embeddings, pos_embedding_matrix) that combines token embeddings with absolute positional embeddings, as commonly done at the input of GPT-style models.
Inputs:
token_embeddings: a numpy array of shape (batch_size, seq_len, embed_dim) containing token embedding vectors.pos_embedding_matrix: a numpy array of shape (context_length, embed_dim) containing learned positional embeddings for each absolute position 0, 1, ..., context_length - 1.The function should select the first seq_len rows of pos_embedding_matrix (positions 0 through seq_len - 1) and add them to every sequence in the batch, broadcasting across the batch dimension. Return a numpy array of shape (batch_size, seq_len, embed_dim).
You may assume seq_len <= context_length.