mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-15 19:47:24 +08:00
Merge dfd64dbdd7 into 3d870ff51f
This commit is contained in:
commit
175e053855
@ -136,7 +136,7 @@ class ImageFromBatch(IO.ComfyNode):
|
|||||||
category="image/batch",
|
category="image/batch",
|
||||||
inputs=[
|
inputs=[
|
||||||
IO.Image.Input("image"),
|
IO.Image.Input("image"),
|
||||||
IO.Int.Input("batch_index", default=0, min=0, max=4095),
|
IO.Int.Input("batch_index", default=0, min=-MAX_RESOLUTION, max=MAX_RESOLUTION),
|
||||||
IO.Int.Input("length", default=1, min=1, max=4096),
|
IO.Int.Input("length", default=1, min=1, max=4096),
|
||||||
],
|
],
|
||||||
outputs=[IO.Image.Output()],
|
outputs=[IO.Image.Output()],
|
||||||
@ -145,7 +145,9 @@ class ImageFromBatch(IO.ComfyNode):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def execute(cls, image, batch_index, length) -> IO.NodeOutput:
|
def execute(cls, image, batch_index, length) -> IO.NodeOutput:
|
||||||
s_in = image
|
s_in = image
|
||||||
batch_index = min(s_in.shape[0] - 1, batch_index)
|
if batch_index < 0:
|
||||||
|
batch_index += s_in.shape[0]
|
||||||
|
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)
|
||||||
|
|||||||
6
nodes.py
6
nodes.py
@ -1221,7 +1221,7 @@ class LatentFromBatch:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
return {"required": { "samples": ("LATENT",),
|
return {"required": { "samples": ("LATENT",),
|
||||||
"batch_index": ("INT", {"default": 0, "min": 0, "max": 63}),
|
"batch_index": ("INT", {"default": 0, "min": -MAX_RESOLUTION, "max": MAX_RESOLUTION}),
|
||||||
"length": ("INT", {"default": 1, "min": 1, "max": 64}),
|
"length": ("INT", {"default": 1, "min": 1, "max": 64}),
|
||||||
}}
|
}}
|
||||||
RETURN_TYPES = ("LATENT",)
|
RETURN_TYPES = ("LATENT",)
|
||||||
@ -1232,7 +1232,9 @@ class LatentFromBatch:
|
|||||||
def frombatch(self, samples, batch_index, length):
|
def frombatch(self, samples, batch_index, length):
|
||||||
s = samples.copy()
|
s = samples.copy()
|
||||||
s_in = samples["samples"]
|
s_in = samples["samples"]
|
||||||
batch_index = min(s_in.shape[0] - 1, batch_index)
|
if batch_index < 0:
|
||||||
|
batch_index += s_in.shape[0]
|
||||||
|
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