BrokenPipeError: [Errno 32] Broken pipe解决办法

BrokenPipeError: [Errno 32] Broken pipe解决办法_第1张图片


trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
                                        download=True, transform=transform)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=4,
                                          shuffle=True, num_workers=2)

testset = torchvision.datasets.CIFAR10(root='./data', train=False,
                                       download=True, transform=transform)
testloader = torch.utils.data.DataLoader(testset, batch_size=4,
                                         shuffle=False, num_workers=2)

经查资料
把num_workers=2改为 num_workers=0即可正常运行

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