MCPcopy Create free account
hub / github.com/GuoLanqing/ShadowFormer / tensor2uint

Function tensor2uint

utils/image_utils.py:113–117  ·  view source on GitHub ↗
(img)

Source from the content-addressed store, hash-verified

111 return real_lab - fake_lab
112
113def tensor2uint(img):
114 img = img.data.squeeze().float().clamp_(0, 1).cpu().numpy()
115 if img.ndim == 3:
116 img = np.transpose(img, (1, 2, 0))
117 return np.uint8((img*255.0).round())
118
119def imsave(img, img_path):
120 img = np.squeeze(img)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected