MCPcopy Create free account
hub / github.com/LetterLiGo/SafeGen_CCS2024 / denormalize

Method denormalize

src/diffusers/image_processor.py:145–149  ·  view source on GitHub ↗

Denormalize an image array to [0,1].

(images: Union[np.ndarray, torch.Tensor])

Source from the content-addressed store, hash-verified

143
144 @staticmethod
145 def denormalize(images: Union[np.ndarray, torch.Tensor]) -> Union[np.ndarray, torch.Tensor]:
146 """
147 Denormalize an image array to [0,1].
148 """
149 return (images / 2 + 0.5).clamp(0, 1)
150
151 @staticmethod
152 def convert_to_rgb(image: PIL.Image.Image) -> PIL.Image.Image:

Callers 2

postprocessMethod · 0.95
postprocessMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected