• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
返回主页

听风不成泣

  • 博客园
  • 首页
  • 新随笔
  • 联系
  • 订阅
  • 管理

Tensors of the same index must be on the same device and the same dtype except `step` tensors that can be CPU and float32 notwithstanding

避免使用 torch.set_default_dtype(torch.float64)

 

可以尝试采用

model. Double
或者
model.to(torch. Double)

m = torch().to(device).to(torch.float64)

 

 

 

 

 

参考:

Tensors of the same index must be on the same device and the same dtype except `step` tensors that can be CPU and float32 notwithstanding - PyTorch Forums

PyTorch: Tensors of the same index must be on the same device and the same dtype except `step` tenso_runtimeerror: tensors of the same index must be on-CSDN博客

 

posted @ 2024-05-25 17:14  听风不成泣  阅读(238)  评论(0)    收藏  举报
刷新页面返回顶部

公告

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3