真的成功解决!RuntimeError:Input type(torch.cuda.HalfTensor) and weight typet(torch.cuda.FloatTenor)
原因:YOLO系列的代码由于在使用PyTorch的自动混合精度训练(AMP)时,输入张量和权重张量的数据类型不一致所致。在这种情况下,input(输入)是半精度浮点数(HalfTensor),而weight(权重)是单精度浮点数(FloatTensor)方法:amp=False
原创
2025-03-25 21:44:49 ·
155 阅读 ·
0 评论