MCPcopy Create free account
hub / github.com/Lizhe1228/MambaDFuse / tensor2uint

Function tensor2uint

utils/utils_image.py:294–298  ·  view source on GitHub ↗
(img)

Source from the content-addressed store, hash-verified

292
293# convert 2/3/4-dimensional torch tensor to uint
294def 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# --------------------------------------------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected