You could use this code snippet to transform your class indices into a one-hot encoded target:
target = torch.randint(0, 10, (10,))
one_hot = torch.nn.functional.one_hot(target)
You could use this code snippet to transform your class indices into a one-hot encoded target:
target = torch.randint(0, 10, (10,))
one_hot = torch.nn.functional.one_hot(target)