bug:Attempted to set the storage of a tensor on device “cpu“ to

RuntimeError: Attempted to set the storage of a tensor on device "cpu" to a storage on different device "cuda:0". This is no longer allowed; the devices must match.

  • 问题详细
  • 解决方案

问题详细

在进行SSD网路的学习时,使用大佬的pytorch版本的ssd网路遇到的问题。

https://github.com/bubbliiiing/ssd-pytorch/
bug:Attempted to set the storage of a tensor on device “cpu“ to_第1张图片

解决方案

使用的预训练model权重出了问题,一开始使用的是vgg16_reducedfc.pth。转为大佬教学中的model(ssd_weights.pth)后,就成功读取完毕。

你可能感兴趣的:(bug,深度学习,pytorch)