From 64c6c8d71d9b6fc05f409bf971d12cdc6e679059 Mon Sep 17 00:00:00 2001 From: Andrew <247631528+oroboros083-jpg@users.noreply.github.com> Date: Sun, 11 Oct 2026 10:40:42 -0500 Subject: [PATCH] Clone, not copy, the RGB slice of a tensor in tensor_convert_rgb tensor_convert_rgb is typed for NHWC torch tensors, but with prefer_copy it called image.copy(), which torch.Tensor does not have, so every RGBA image raised AttributeError. Use clone() for a tensor and keep copy() for a numpy array. Fixes #1194, fixes #1178. Co-Authored-By: Claude Opus 5.5 --- modules/impact/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/impact/utils.py b/modules/impact/utils.py index d8fb40ca..03757d41 100644 --- a/modules/impact/utils.py +++ b/modules/impact/utils.py @@ -54,7 +54,8 @@ def tensor_convert_rgb(image, prefer_copy=True): if n_channel == 4: image = image[..., :3] if prefer_copy: - image = image.copy() + # torch tensors have clone(), not copy(); numpy arrays have copy(). + image = image.clone() if torch.is_tensor(image) else image.copy() return image if n_channel == 1: