mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-27 17:37:39 +08:00
Clamp out-of-range negative batch_index to start of batch
This commit is contained in:
parent
a927795108
commit
73bdfaf639
@ -147,7 +147,7 @@ class ImageFromBatch(IO.ComfyNode):
|
|||||||
s_in = image
|
s_in = image
|
||||||
if batch_index < 0:
|
if batch_index < 0:
|
||||||
batch_index += s_in.shape[0]
|
batch_index += s_in.shape[0]
|
||||||
batch_index = min(s_in.shape[0] - 1, batch_index)
|
batch_index = max(0, min(s_in.shape[0] - 1, batch_index))
|
||||||
length = min(s_in.shape[0] - batch_index, length)
|
length = min(s_in.shape[0] - batch_index, length)
|
||||||
s = s_in[batch_index:batch_index + length].clone()
|
s = s_in[batch_index:batch_index + length].clone()
|
||||||
return IO.NodeOutput(s)
|
return IO.NodeOutput(s)
|
||||||
|
|||||||
2
nodes.py
2
nodes.py
@ -1234,7 +1234,7 @@ class LatentFromBatch:
|
|||||||
s_in = samples["samples"]
|
s_in = samples["samples"]
|
||||||
if batch_index < 0:
|
if batch_index < 0:
|
||||||
batch_index += s_in.shape[0]
|
batch_index += s_in.shape[0]
|
||||||
batch_index = min(s_in.shape[0] - 1, batch_index)
|
batch_index = max(0, min(s_in.shape[0] - 1, batch_index))
|
||||||
length = min(s_in.shape[0] - batch_index, length)
|
length = min(s_in.shape[0] - batch_index, length)
|
||||||
s["samples"] = s_in[batch_index:batch_index + length].clone()
|
s["samples"] = s_in[batch_index:batch_index + length].clone()
|
||||||
if "noise_mask" in samples:
|
if "noise_mask" in samples:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user