Display image for Tensor.
(inp, title=None)
| 111 | # augmentations. |
| 112 | |
| 113 | def imshow(inp, title=None): |
| 114 | """Display image for Tensor.""" |
| 115 | inp = inp.numpy().transpose((1, 2, 0)) |
| 116 | mean = np.array([0.485, 0.456, 0.406]) |
| 117 | std = np.array([0.229, 0.224, 0.225]) |
| 118 | inp = std * inp + mean |
| 119 | inp = np.clip(inp, 0, 1) |
| 120 | plt.imshow(inp) |
| 121 | if title is not None: |
| 122 | plt.title(title) |
| 123 | plt.pause(0.001) # pause a bit so that plots are updated |
| 124 | |
| 125 | |
| 126 | # Get a batch of training data |
no outgoing calls
no test coverage detected