出现错误:
RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cpu
这是由于之前训练model的时候,采用的是nn.DataParallel()进行多GPU训练,因此如果希望在CPU上进行测试,则将
device = 'cpu'
net = net.to(device)
<
出现错误:
RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cpu
这是由于之前训练model的时候,采用的是nn.DataParallel()进行多GPU训练,因此如果希望在CPU上进行测试,则将
device = 'cpu'
net = net.to(device)
<