kevinzakka / pytorch-goodies

PyTorch Boilerplate For Research

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

One hot encoding

ashnair1 opened this issue · comments

I had a question about how one hot encoding is done.

Why is it done like this:

true_1_hot = torch.eye(num_classes + 1)[true.squeeze(1)]

when it could be implemented like this

true_1_hot = F.one_hot(true, num_classes + 1)

Am I missing something or was F.one_hot added later?