import torch


def get_target_tensor(target_sequences):
    """
    Flattens a batch of target sequences into one long tensor (length: number_sequences * sequence_length)
    """

    target_tensors = [torch.tensor(s) for s in target_sequences]
    
    if torch.cuda.is_available():
        return torch.stack(target_tensors).flatten().cuda()
    else:
        return torch.stack(target_tensors).flatten()