“`” 参考回答: cuda()将操作对象放在GPU内存中,加了cuda()的Tensor放在GPU内存中而没加的Tensor放在CPU内存中,所以这两个Tensor相加会报错。 <pre><code> "“` Was this helpful? YesNo 0 / 0 上一篇: python中dict和list的区别,dict的内部实现? 下一篇: Ctrl+C 程序挂掉还是抛出异常,如何判断两个dict是否一样,list头上删除元素,字符串拼接? 发表回复 取消回复0 Your email address will not be published. 在此浏览器中保存我的显示名称、邮箱地址和网站地址,以便下次评论时使用。