From ae1655261778c0d2c8d8ea15abbf4c1dbfe0f7a2 Mon Sep 17 00:00:00 2001 From: danyharoun Date: Tue, 3 Sep 2024 18:04:25 +0400 Subject: [PATCH] small improvements to NilorRepeatTrimImageBatch node. --- nilornodes.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/nilornodes.py b/nilornodes.py index c0e7189..6f6e870 100644 --- a/nilornodes.py +++ b/nilornodes.py @@ -505,16 +505,14 @@ class NilorRepeatTrimImageBatch: if len(images.shape) != 4: raise ValueError(f"Expected 4D tensor (batch, channels, height, width), got shape {images.shape}") - def repeat_trim_image_batch(self, images, count): + def repeat_trim_image_batch(self, images: torch.Tensor, count): self._check_image_dimensions(images) - images_count = images.size(0) - amount = math.ceil(count / images_count) + batch_count = images.size(0) + amount = math.ceil(count / batch_count) appended_tensors = images.repeat(amount, 1, 1, 1), - batched_tensors = torch.cat(appended_tensors, dim=0) - trimmed_tensors = batched_tensors[:count] return (trimmed_tensors,) @@ -607,6 +605,6 @@ NODE_DISPLAY_NAME_MAPPINGS = { "Nilor Select Index From List": "👺 Select Index From List", "Nilor Save EXR Arbitrary": "👺 Save EXR Arbitrary", "Nilor Shuffle Image Batch": "👺 Nilor Shuffle Image Batch", - "Nilor Repeat & Trim Image Batch": "👺 Nilor Repeat Trim Image Batch", + "Nilor Repeat & Trim Image Batch": "👺 Nilor Repeat & Trim Image Batch", "Nilor Output Filename String": "👺 Nilor Output Filename String" }