I had sort of the same issue (on a macos 12.6.2). A kernel crash when using torchvision.
trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
testset = torchvision.datasets.CIFAR10(root='./data', train=False,
download=True, transform=transform)
classes = ('plane', 'car', 'bird', 'cat',
'deer', 'dog', 'frog', 'horse', 'ship', 'truck')
batch_size = 64
trainloader = th.utils.data.DataLoader(trainset, batch_size=batch_size,
shuffle=True, num_workers=0)
testloader = th.utils.data.DataLoader(testset, batch_size=batch_size,
shuffle=False, num_workers=0)
dataiter = iter(trainloader)
images, labels = next(dataiter)
I solved it by reinstalling pytorch and torchvision. Run in a script (jupyter notebook or elsewhere):
!conda install --yes pytorch torchvision -c pytorch