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

Function uint2tensor4

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

Source from the content-addressed store, hash-verified

273
274# convert uint to 4-dimensional torch tensor
275def uint2tensor4(img):
276 if img.ndim == 2:
277 img = np.expand_dims(img, axis=2)
278 return torch.from_numpy(np.ascontiguousarray(img)).permute(2, 0, 1).float().div(255.).unsqueeze(0)
279
280
281# convert uint to 3-dimensional torch tensor

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected