from typing import List
from typing import DefaultDict
import torch


def prepare_sequence(seq: List[str], to_ix: DefaultDict[str, int]) -> torch.Tensor:
    """
    Converts a sequence (used here for characters) into a tensor of integers.
    """
    idxs = [to_ix[w] for w in seq]

    return torch.tensor(idxs, dtype=torch.long)