pytorch允许把在GPU上训练的模型加载到CPU上,也允许把在CPU上训练的模型加载到GPU上。


CPU->CPU,GPU->GPU

torch.load('gen_500000.pkl')


GPU->CPU

torch.load('gen_500000.pkl', map_location=lambda storage, loc: storage)


CPU->GPU1

torch.load('gen_500000.pkl', map_location=lambda storage, loc: storage.cuda(1))



相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-01
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
猜你喜欢
  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案