r""" Normalize an image array to [-1,1]. Args: images (`np.ndarray` or `torch.Tensor`): The image array to normalize. Returns: `np.ndarray` or `torch.Tensor`: The normalized image array.
(images: np.ndarray | torch.Tensor)
| 205 | |
| 206 | @staticmethod |
| 207 | def normalize(images: np.ndarray | torch.Tensor) -> np.ndarray | torch.Tensor: |
| 208 | r""" |
| 209 | Normalize an image array to [-1,1]. |
| 210 | |
| 211 | Args: |
| 212 | images (`np.ndarray` or `torch.Tensor`): |
| 213 | The image array to normalize. |
| 214 | |
| 215 | Returns: |
| 216 | `np.ndarray` or `torch.Tensor`: |
| 217 | The normalized image array. |
| 218 | """ |
| 219 | return 2.0 * images - 1.0 |
| 220 | |
| 221 | @staticmethod |
| 222 | def denormalize(images: np.ndarray | torch.Tensor) -> np.ndarray | torch.Tensor: |
no outgoing calls
no test coverage detected