MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / tensor2single3

Function tensor2single3

ldm/modules/image_degradation/utils_image.py:320–326  ·  view source on GitHub ↗
(img)

Source from the content-addressed store, hash-verified

318
319# convert torch tensor to single
320def tensor2single3(img):
321 img = img.data.squeeze().float().cpu().numpy()
322 if img.ndim == 3:
323 img = np.transpose(img, (1, 2, 0))
324 elif img.ndim == 2:
325 img = np.expand_dims(img, axis=2)
326 return img
327
328
329def single2tensor5(img):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected