MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / from_pil_image

Function from_pil_image

k_diffusion/utils.py:20–25  ·  view source on GitHub ↗

Converts from a PIL image to a tensor.

(x)

Source from the content-addressed store, hash-verified

18
19
20def from_pil_image(x):
21 """Converts from a PIL image to a tensor."""
22 x = TF.to_tensor(x)
23 if x.ndim == 2:
24 x = x[..., None]
25 return x * 2 - 1
26
27
28def to_pil_image(x):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected