pytorch 在用gpu训练模型训练 损失函数不需要迁移到gpu

在进行pytorch 训练时候,输入的数据tensor,以及模型需要.cuda,但是在做损失函数的时候,就不需要将Loss函数设置为cuda形式了,因为此时送入loss的数据已经是cuda类型的了,损失就会在这上面直接计算。

发布了36 篇原创文章 · 获赞 11 · 访问量 6531

猜你喜欢

转载自blog.csdn.net/t20134297/article/details/104937971