I am new to PyTorch. I need some help to implement a custom loss. So, my model output shape is [256,462](256 is minibatch size) and my target shape is , where the target is just label encoder. I want to write a function that receives target shape as  and convert to [256,462] one hot encode tensor. My number of class is 462. Then I want to do some calculations in GPU.
How can I convert the target shape of  to [256,462] with one hot encoding?