I don’t know if it’s possible, but I’m interested in why you would want to use CrossEntropyLoss?
I have used MSELoss for similar things with good results.
Also, unless I’m very mistaken, the targets for nn.CrossEntropyLoss are not one-hot.