MCPcopy
hub / github.com/cubiq/ComfyUI_InstantID / tensor_to_image

Function tensor_to_image

utils.py:16–19  ·  view source on GitHub ↗
(tensor)

Source from the content-addressed store, hash-verified

14 return source
15
16def tensor_to_image(tensor):
17 image = tensor.mul(255).clamp(0, 255).byte().cpu()
18 image = image[..., [2, 1, 0]].numpy()
19 return image
20
21def image_to_tensor(image):
22 tensor = torch.clamp(torch.from_numpy(image).float() / 255., 0, 1)

Callers 1

extractFeaturesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected