MCPcopy Index your code
hub / github.com/pytorch/tutorials / matplotlib_imshow

Function matplotlib_imshow

beginner_source/introyt/trainingyt.py:106–114  ·  view source on GitHub ↗
(img, one_channel=False)

Source from the content-addressed store, hash-verified

104
105# Helper function for inline image display
106def matplotlib_imshow(img, one_channel=False):
107 if one_channel:
108 img = img.mean(dim=0)
109 img = img / 2 + 0.5 # unnormalize
110 npimg = img.numpy()
111 if one_channel:
112 plt.imshow(npimg, cmap="Greys")
113 else:
114 plt.imshow(np.transpose(npimg, (1, 2, 0)))
115
116dataiter = iter(training_loader)
117images, labels = next(dataiter)

Callers 1

trainingyt.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected