RuntimeError_ Found dtype Long but expected Float

When running the model, an error occurred:

RuntimeError: Found dtype Long but expected Float

The error occurs in the BCE loss part, because crossentropyloss requires that batch_label must be of torch.float type,
so you need to modify the label and convert it to float format:

image.png

参考:
【RuntimeError: Found dtype Long but expected Float】
https://blog.csdn.net/znevegiveup1/article/details/124778676

Guess you like

Origin blog.csdn.net/Alexa_/article/details/134300380