import torch


def longtensor_to_one_hot(labels, num_classes):
    """convert int encoded label to one-hot encoding

    Args:
        labels :[batch_size, 1]:
        num_classes :int:

    Returns:
        one-hot encoded label :[batch_size, num_classes]:
    """
    return torch.zeros(labels.shape[0], num_classes).scatter_(1, labels, 1)