Pytorch测试神经网络时出现“RuntimeError: Error(s) in loading state_dict for Net”

解决方法:code load_state_dict(torch.load('net.pth')在前,增长 model = nn.DataParallel(model) 就能够了。class   好比model net = NET() net.cuda() net = nn.DataParallel(net) net.load_state_dict(torch.load('net.pth')
相关文章
相关标签/搜索