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