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

Method normalize

src/diffusers/image_processor.py:138–142  ·  view source on GitHub ↗

Normalize an image array to [-1,1].

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

Source from the content-addressed store, hash-verified

136
137 @staticmethod
138 def normalize(images: Union[np.ndarray, torch.Tensor]) -> Union[np.ndarray, torch.Tensor]:
139 """
140 Normalize an image array to [-1,1].
141 """
142 return 2.0 * images - 1.0
143
144 @staticmethod
145 def denormalize(images: Union[np.ndarray, torch.Tensor]) -> Union[np.ndarray, torch.Tensor]:

Callers 4

preprocessMethod · 0.95
preprocessMethod · 0.45

Calls

no outgoing calls