import torch
import torchvision
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import numpy as np
transform = transforms.Compose(
[transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
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)
classes = (‘plane’, ‘car’, ‘bird’, ‘cat’,
‘deer’, ‘dog’, ‘frog’, ‘horse’, ‘ship’, ‘truck’)
functions to show an image
def imshow(img):
img = img / 2 + 0.5     # unnormalize
npimg = img.numpy()
plt.imshow(np.transpose(npimg, (1, 2, 0)))
#plt.show()
get some random training images
dataiter = iter(trainloader)
images, labels = dataiter.next()
show images
imshow(torchvision.utils.make_grid(images))
plt.show()
print labels
print(’ ‘.join(’%5s’ % classes[labels[j]] for j in range(4)))
The pictures can’t be shown in my computer complied by Pycharm. I use the Pycharm to connect  the Server(CentOS).
But  the pictures can be  shown in my computer compiled by JupyterNotebook. I am very confused .Please Help me!
Error Message:
ssh://cong_pan@172.18.11.12:22/data/cong_pan/anaconda3/bin/python3.6 -u /data/cong_pan/jiaqi_wang/code/pytorch/showphoto.py
Files already downloaded and verified
Files already downloaded and verified
dog horse   car horse
Exception ignored in: <bound method DataLoaderIter.del of <torch.utils.data.dataloader.DataLoaderIter object at 0x7f7253d55eb8>>
Traceback (most recent call last):
File “/data/cong_pan/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py”, line 333, in del
File “/data/cong_pan/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py”, line 319, in _shutdown_workers
File “/data/cong_pan/anaconda3/lib/python3.6/multiprocessing/queues.py”, line 345, in get
ImportError: sys.meta_path is None, Python is likely shutting down
Process finished with exit code 0