aboutsummaryrefslogtreecommitdiff
path: root/modules/upscaler_utils.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2024-01-04 11:15:50 +0300
committerGitHub <noreply@github.com>2024-01-04 11:15:50 +0300
commitdf62ffbd2525792c115adefdbaeb7799699624b1 (patch)
treec5bd1c25eae4d890b7f5f79d938ca5e04802bafc /modules/upscaler_utils.py
parentd9034b48a526f0a0c3e8f0dbf7c171bf4f0597fd (diff)
parent149c9d223463c8fc34f53f26ca06e02be4c8835b (diff)
Merge branch 'dev' into avoid-isfiles
Diffstat (limited to 'modules/upscaler_utils.py')
-rw-r--r--modules/upscaler_utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/upscaler_utils.py b/modules/upscaler_utils.py
index e4c63f09..4f1417cf 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")