pytorch one hot 的转换

转onehot

one_hot = F.one_hot(label.long(), num_classes=n_classes)

转回来

label = torch.argmax(one_hot, -1)