Skip to content

Commit 9c6ea53

Browse files
Merge pull request #14504 from akx/you-spin-me-round
torch_bgr_to_pil_image: round, don't truncate
2 parents e4dcdcc + 7ad6899 commit 9c6ea53

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/upscaler_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def torch_bgr_to_pil_image(tensor: torch.Tensor) -> Image.Image:
3030
# TODO: is `tensor.float().cpu()...numpy()` the most efficient idiom?
3131
arr = tensor.float().cpu().clamp_(0, 1).numpy() # clamp
3232
arr = 255.0 * np.moveaxis(arr, 0, 2) # CHW to HWC, rescale
33-
arr = arr.astype(np.uint8)
33+
arr = arr.round().astype(np.uint8)
3434
arr = arr[:, :, ::-1] # flip BGR to RGB
3535
return Image.fromarray(arr, "RGB")
3636

0 commit comments

Comments
 (0)