MCPcopy Index your code
hub / github.com/huggingface/diffusers / pt_to_pil

Function pt_to_pil

src/diffusers/utils/pil_utils.py:25–32  ·  view source on GitHub ↗

Convert a torch image to a PIL image.

(images)

Source from the content-addressed store, hash-verified

23
24
25def pt_to_pil(images):
26 """
27 Convert a torch image to a PIL image.
28 """
29 images = (images / 2 + 0.5).clamp(0, 1)
30 images = images.cpu().permute(0, 2, 3, 1).float().numpy()
31 images = numpy_to_pil(images)
32 return images
33
34
35def numpy_to_pil(images):

Callers

nothing calls this directly

Calls 2

numpy_to_pilFunction · 0.85
floatMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…