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

Function single2tensor4

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

Source from the content-addressed store, hash-verified

305
306# convert single (HxWxC) to 4-dimensional torch tensor
307def single2tensor4(img):
308 return torch.from_numpy(np.ascontiguousarray(img)).permute(2, 0, 1).float().unsqueeze(0)
309
310
311# convert torch tensor to single

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected