RuntimeError_ Found dtype Long but expected Float

在跑模型的时候,出现了报错:

RuntimeError: Found dtype Long but expected Float

报错是发生在BCE loss 的部分,因为crossentropyloss要求batch_label必须为torch.float类型
所以需要修改一下标签,转为float格式就好了:

image.png

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

猜你喜欢

转载自blog.csdn.net/Alexa_/article/details/134300380
今日推荐