import torch


def input_2_tensor(input_seq, encoding_space):
    """convert regular sequence of values to one hot encoding tensor"""

    input_tensor = torch.zeros((len(input_seq), len(encoding_space)), dtype=torch.float)
    for e, element in enumerate(input_seq):
        element_tensor = torch.zeros(len(encoding_space), dtype=torch.float)
        index = encoding_space.index(element)
        element_tensor[index] = 1
        input_tensor[e] = element_tensor

    return input_tensor