CPython versions tested on: 3.9.12
Operating system and architecture: Fedora 34
I imported DataLoader from torch.utils.data in IDLE. I included everything under if __name__ == '__main__': and still get "do you want to kill it?" message. Then the process stops running.
This program has no errors when run from the command line, just when it's run in IDLE.
from torchvision import datasets
from torchvision.transforms import ToTensor
from matplotlib import pyplot as plt
training_data = datasets.FashionMNIST(
root="data",
train=True,
download=True,
transform=ToTensor()
)
test_data = datasets.FashionMNIST(
root="data",
train=False,
download=True,
transform=ToTensor()
)
from torch.utils.data import DataLoader
train_dataloader = DataLoader(training_data, batch_size=64, num_workers=10, shuffle=True)
test_dataloader = DataLoader(test_data, batch_size=64, num_workers=10, shuffle=True)
# Display image and label.
train_features, train_labels = next(iter(train_dataloader))
print(f"Feature batch shape: {train_features.size()}")
print(f"Labels batch shape: {train_labels.size()}")
img = train_features[0].squeeze()
label = train_labels[0]
print(f"Label: {label}")
plt.imshow(img, cmap="gray")
plt.show()
Your environment
- CPython versions tested on: 3.9.12
- Operating system and architecture: Fedora 34
CPython versions tested on: 3.9.12
Operating system and architecture: Fedora 34
I imported DataLoader from torch.utils.data in IDLE. I included everything under
if __name__ == '__main__':and still get "do you want to kill it?" message. Then the process stops running.This program has no errors when run from the command line, just when it's run in IDLE.
Your environment