首页
编程
java
php
前端
首页
编程
java
php
前端
各位佬这句报错咋解决呀
报错Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
谢谢
解决Expected all tensors to be on the same device, but found at least two devices, cuda:0_wx62cea850b9e28的技术博客_51CTO博客
解决Expected all tensors to be on the same device, but found at least two devices, cuda:0,(1)可能是模型没有移动到和数据相同的device上:`model.to(device)`(2)可能是input和参数没有在相同device上
https://blog.51cto.com/u_15717393/5605701
RuntimeError: Expected all tensors to be on the same device, but found at least two devices_德国Viviane的博客-CSDN博客
运行以下代码时报错,这是在函数定义里,且当时loss和model都有.to(device)的操作在网上找了很久都没有找到原因,报错的地方在cat:即在在数据拼接的时候,即一个数据在GPU0上,一个数据在GPU1上,这就会出现错误修改地方:一定要注意,产生随机数的地方也要用.to(device)
https://blog.csdn.net/Viviane_2022/article/details/128638452
点击展开全文