import torch


def label_to_onehot(labels, num_classes=10):
    """ Converts label into a vector.

    Args:
        labels (int): Class label to convert to tensor.
        num_classes (int):  Number of classes for the model.

    Returns:
        (torch.tensor): Torch tensor with 0's everywhere except for 1 in
            correct class.
    """
    one_hot = torch.eye(num_classes)
    return one_hot[labels.long()]