import torch


def pad_emb_scores(scores, vocab):
    """ Pad list of music scores embeddings
    @param inputs (list[tensor]): list of embeddings for each score in batch
    @param vocab (Vocab)
    @returns padded_batch (list[list[int]]): tensor of scores where scores shorter
        than the max length scores are padded out with the pad_token, such that
        each score in the batch now has equal length.
        Output shape: (batch_size, max_score_length)
    """
    max_len = max(len(score) for score in scores)
    padded_batch = []

    for i in range(len(scores)):
        padded_batch.append(torch.cat((scores[i], torch.zeros(max_len-scores[i].shape[0]).long()+vocab.stoi['xxpad'])))
    
    padded_batch = torch.stack(padded_batch, dim = 0)

    return padded_batch