RuntimeError:预期的设备cpu和dtype字节,但获得了设备cpu和dtype Bool

时间:2019-10-02 17:37:51

标签: pytorch cpu archlinux

the issue I opened中所述,在CPU上运行Pytorch inverse-cooking模型时出现以下错误:

RuntimeError: expected device cpu and dtype Byte but got device cpu and dtype Bool

我尝试在笔记本电脑的Intel i7-4700HQ 8线程和台式机Ryzen 3700x中运行demo.ipynb文件。我在笔记本电脑上使用Arch Linux,在台式机上使用Manjaro。

当我在Google Collabs GPU上运行该模型时,该模型运行良好。

根据demo.ipynb文件,该模型也应该能够在CPU上运行。有谁知道我是否必须调整任何参数才能使其正常工作?

1 个答案:

答案 0 :(得分:0)

如@iacolippo以及在注释会话和myDennisCode中所述,问题确实是依赖版本。我有torchvision==0.4.0(让我感到困惑)和torch==1.2.0

要解决此问题,只需安装torch==0.4.1torchvision==0.2.1