(img)
| 292 | |
| 293 | # convert 2/3/4-dimensional torch tensor to uint |
| 294 | def tensor2uint(img): |
| 295 | img = img.data.squeeze().float().clamp_(0, 1).cpu().numpy() |
| 296 | if img.ndim == 3: |
| 297 | img = np.transpose(img, (1, 2, 0)) |
| 298 | return np.uint8((img*255.0).round()) |
| 299 | |
| 300 | |
| 301 | # -------------------------------------------- |
nothing calls this directly
no outgoing calls
no test coverage detected