It is obvious why CrossEntropyLoss() only accepts Long type targets. however, I ran it on Pycharm IDE with float type targets and it worked!! My target is a 2D heatmap with 0 background and a spot that has float values between 0 and 1. The same example raised an error on Colab.
The question is whether Python explicitly assigns a Long type value as a class to every different value?