Skip to content

Commit 74c17a2

Browse files
authored
Fix void failing with RuntimeError: start (0) + length (464) exceeds dimension size (461). (Comfy-Org#13873)
1 parent afb4fa1 commit 74c17a2

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

comfy/utils.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,12 +1164,18 @@ def mult_list_upscale(a):
11641164

11651165
o = out
11661166
o_d = out_div
1167+
ps_view = ps
1168+
mask_view = mask
11671169
for d in range(dims):
1168-
o = o.narrow(d + 2, upscaled[d], mask.shape[d + 2])
1169-
o_d = o_d.narrow(d + 2, upscaled[d], mask.shape[d + 2])
1170-
1171-
o.add_(ps * mask)
1172-
o_d.add_(mask)
1170+
l = min(ps_view.shape[d + 2], o.shape[d + 2] - upscaled[d])
1171+
o = o.narrow(d + 2, upscaled[d], l)
1172+
o_d = o_d.narrow(d + 2, upscaled[d], l)
1173+
if l < ps_view.shape[d + 2]:
1174+
ps_view = ps_view.narrow(d + 2, 0, l)
1175+
mask_view = mask_view.narrow(d + 2, 0, l)
1176+
1177+
o.add_(ps_view * mask_view)
1178+
o_d.add_(mask_view)
11731179

11741180
if pbar is not None:
11751181
pbar.update(1)

0 commit comments

Comments
 (0)