(tensor)
| 288 | |
| 289 | |
| 290 | def view(tensor): |
| 291 | image = tensor_to_img_array(tensor) |
| 292 | assert len(image.shape) in [ |
| 293 | 3, |
| 294 | 4, |
| 295 | ], "Image should have 3 or 4 dimensions, invalid image shape {}".format(image.shape) |
| 296 | # Change dtype for PIL.Image |
| 297 | image = (image * 255).astype(np.uint8) |
| 298 | if len(image.shape) == 4: |
| 299 | image = np.concatenate(image, axis=1) |
| 300 | Image.fromarray(image).show() |
| 301 | |
| 302 | |
| 303 |
nothing calls this directly
no test coverage detected