(img, one_channel=False)
| 101 | |
| 102 | # Helper function for inline image display |
| 103 | def matplotlib_imshow(img, one_channel=False): |
| 104 | if one_channel: |
| 105 | img = img.mean(dim=0) |
| 106 | img = img / 2 + 0.5 # unnormalize |
| 107 | npimg = img.numpy() |
| 108 | if one_channel: |
| 109 | plt.imshow(npimg, cmap="Greys") |
| 110 | else: |
| 111 | plt.imshow(np.transpose(npimg, (1, 2, 0))) |
| 112 | |
| 113 | # Extract a batch of 4 images |
| 114 | dataiter = iter(training_loader) |
no outgoing calls
no test coverage detected