def METHOD_NAME(indice, max_length, pad_idx=tokenizer.token_end_id):
    pad_indice = [
        item.tolist() + [pad_idx] * max(0, max_length - len(item.tolist()))
        for item in indice
    ]
    return torch.tensor(pad_indice)