diff --git a/modules/upscaler_utils.py b/modules/upscaler_utils.py index e4c63f09758..4f1417cf06a 100644 --- a/modules/upscaler_utils.py +++ b/modules/upscaler_utils.py @@ -30,7 +30,7 @@ def torch_bgr_to_pil_image(tensor: torch.Tensor) -> Image.Image: # TODO: is `tensor.float().cpu()...numpy()` the most efficient idiom? arr = tensor.float().cpu().clamp_(0, 1).numpy() # clamp arr = 255.0 * np.moveaxis(arr, 0, 2) # CHW to HWC, rescale - arr = arr.astype(np.uint8) + arr = arr.round().astype(np.uint8) arr = arr[:, :, ::-1] # flip BGR to RGB return Image.fromarray(arr, "RGB")