Nodes/GPU LayerStyles/GPU LayerStyles BatchConcat
ComfyUI Node

GPU LayerStyles BatchConcat

Glue five clips into one batch (and why the socket order is not what you think)

By lany42·Created 23 days ago·Updated 16 days ago· 0
GPU LayerStyles BatchConcat
  • images
  • image

Most ComfyUI nodes that touch images take a batch - a stack of frames in one tensor. So the moment you generate six variations in six branches, or decode two clips you want to hand to one interpolation node, you need to turn those separate IMAGE outputs into one stack. That is the entire job of GPULayerStyles_BatchConcat, and it does it without touching a single pixel value.

What it does

It concatenates every connected input along the batch dimension, in socket order, into one fresh contiguous tensor. Pixels and frame order are preserved exactly - no resampling, no blending, no dtype conversion. A single connected input still gets copied, so you can use it as a deliberate "make a defensible copy" node when you want a branch to stop sharing memory with another.

The interesting bit is the ordering rule. The inputs are dynamically named image_1 through image_100 and the node sorts them by that number before concatenating - not by the order you happened to drag the wires. That's a genuinely good decision from the author (dictionary insertion order would make output depend on a UI accident), but it means the frame order is fixed by which socket you plugged into. If your output batch starts with the clip you plugged into image_2, that's why.

The one input, and the output

There's exactly one input on the schema: images, a growing autogrow socket set (image_1 … image_100, minimum one connection). Each socket accepts either a single image [H, W, C] or a whole batch [B, H, W, C]; single images get promoted to a batch of one. The output is a single image, and it wires into anything that takes IMAGE - a Video Combine, an interpolation node, a save node, or the next node in this pack.

Autogrow is part of the newer ComfyUI node API (io.Autogrow), so it renders as a socket that spawns the next input as soon as you connect one. If the pack feels unfamiliar - no NODE_CLASS_MAPPINGS, define_schema() everywhere - that's the V3 authoring style, not a broken install.

Where people get burned

Every connected input must match on height, width, channel count (3 or 4), dtype and device. The node checks all five and refuses to guess, which is correct but unforgiving: a batch that came back from a CPU-side path and a batch sitting on the GPU will not concatenate, and you get a validation error naming the socket that disagreed.

The second trap is memory. torch.cat allocates a brand-new tensor while every input is still alive, so peak usage is roughly inputs plus output. Unlike the color nodes in this pack, BatchConcat has no output_device and no batch_size, so there's no chunking and no offload knob - it needs the whole thing in RAM at once. Stitch big batches at the end of a workflow, not in the middle of one.

Install

Via ComfyUI Manager, search the pack title GPU LayerStyles and install; or manually:

cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/lany42/gpu-layerstyles
# restart ComfyUI

That's it. The project's pyproject.toml declares no runtime dependencies at all - nothing gets pip-installed, there are no model files to download, and there's no API key. (Not a coincidence: the README benchmarks this pack against ComfyUI_LayerStyle, whose install log is where a lot of people have historically gotten their ComfyUI environment wrecked. This pack is deliberately the narrow, dependency-free alternative.) Two real requirements: the pack targets Python 3.13+ and needs a ComfyUI new enough to have comfy_api and autogrow inputs. On an older build, the nodes simply won't appear. The project is AGPL-3.0-only, which matters if you're shipping a product around it.

The canonical repo lives at git.colorized.life; GitHub (lany42/gpu-layerstyles) is the mirror you're most likely to land on. Same code.

CategoryGPU LayerStyles/Batch

Inputs (1)

NameTypeDefaultDescription
imagesCOMFY_AUTOGROW_V3Connect images or batches in concatenation order; a new socket appears after each connection, up to 100 inputs.

Outputs (1)

NameTypeDescription
imageIMAGE—