Skip to content

Commit 05df2df

Browse files
Fix RepeatLatentBatch not working on multi dim latents. (Comfy-Org#9227)
1 parent 37d620a commit 05df2df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nodes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,12 +1229,12 @@ def repeat(self, samples, amount):
12291229
s = samples.copy()
12301230
s_in = samples["samples"]
12311231

1232-
s["samples"] = s_in.repeat((amount, 1,1,1))
1232+
s["samples"] = s_in.repeat((amount,) + ((1,) * (s_in.ndim - 1)))
12331233
if "noise_mask" in samples and samples["noise_mask"].shape[0] > 1:
12341234
masks = samples["noise_mask"]
12351235
if masks.shape[0] < s_in.shape[0]:
1236-
masks = masks.repeat(math.ceil(s_in.shape[0] / masks.shape[0]), 1, 1, 1)[:s_in.shape[0]]
1237-
s["noise_mask"] = samples["noise_mask"].repeat((amount, 1,1,1))
1236+
masks = masks.repeat((math.ceil(s_in.shape[0] / masks.shape[0]),) + ((1,) * (masks.ndim - 1)))[:s_in.shape[0]]
1237+
s["noise_mask"] = samples["noise_mask"].repeat((amount,) + ((1,) * (samples["noise_mask"].ndim - 1)))
12381238
if "batch_index" in s:
12391239
offset = max(s["batch_index"]) - min(s["batch_index"]) + 1
12401240
s["batch_index"] = s["batch_index"] + [x + (i * offset) for i in range(1, amount) for x in s["batch_index"]]

0 commit comments

Comments
 (0)