def get_one_hot_encoding(num: int):
    """
    **Overview**:
        Implementation of one hot encoding with nn.Embedding API.
    """
    # Use the identity matrix as weight tensor.
    # Use freezed embedding as fixed one-hot transformation.
    return nn.Embedding.from_pretrained(torch.eye(num), freeze=True, padding_idx=None)

    **Overview**:
        Implementation of one hot encoding with nn.Embedding API.
    
chapter3_obs/encoding.py