mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-05-23 02:35:41 +08:00
Allow repeating masks as well with ImageBatchRepeatInterleaving
This commit is contained in:
parent
c8f5fc0760
commit
d57154c3a8
@ -787,7 +787,7 @@ and passes it through unchanged.
|
|||||||
|
|
||||||
class ImageBatchRepeatInterleaving:
|
class ImageBatchRepeatInterleaving:
|
||||||
|
|
||||||
RETURN_TYPES = ("IMAGE",)
|
RETURN_TYPES = ("IMAGE", "MASK",)
|
||||||
FUNCTION = "repeat"
|
FUNCTION = "repeat"
|
||||||
CATEGORY = "KJNodes/image"
|
CATEGORY = "KJNodes/image"
|
||||||
DESCRIPTION = """
|
DESCRIPTION = """
|
||||||
@ -802,13 +802,20 @@ with repeats 2 becomes batch of 10 images: 0, 0, 1, 1, 2, 2, 3, 3, 4, 4
|
|||||||
"required": {
|
"required": {
|
||||||
"images": ("IMAGE",),
|
"images": ("IMAGE",),
|
||||||
"repeats": ("INT", {"default": 1, "min": 1, "max": 4096}),
|
"repeats": ("INT", {"default": 1, "min": 1, "max": 4096}),
|
||||||
},
|
},
|
||||||
}
|
"optional": {
|
||||||
|
"mask": ("MASK",),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def repeat(self, images, repeats):
|
def repeat(self, images, repeats, mask=None):
|
||||||
|
|
||||||
repeated_images = torch.repeat_interleave(images, repeats=repeats, dim=0)
|
repeated_images = torch.repeat_interleave(images, repeats=repeats, dim=0)
|
||||||
return (repeated_images, )
|
if mask is not None:
|
||||||
|
mask = torch.repeat_interleave(mask, repeats=repeats, dim=0)
|
||||||
|
else:
|
||||||
|
mask = torch.zeros_like(repeated_images[:, 0:1, :, :])
|
||||||
|
return (repeated_images, mask)
|
||||||
|
|
||||||
class ImageUpscaleWithModelBatched:
|
class ImageUpscaleWithModelBatched:
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user