MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / pt_to_pil

Function pt_to_pil

diffusers/src/diffusers/utils/pil_utils.py:27–34  ·  view source on GitHub ↗

Convert a torch image to a PIL image.

(images)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

numpy_to_pilFunction · 0.70

Tested by

no test coverage detected