Latent List to Latent Batch
Stack Latents Back Into a Batch
- latents
- latent
- count
Latent List to Latent Batch does exactly what the name says, in the direction most workflows actually need eventually: it takes a list of individual latents and stacks them back into a single batched latent. It's the return trip for the pack's Latent Batch to Latent List - split a batch, process each latent on its own, then recombine and feed the whole stack to whatever node wants a batch.
How it works
Each latent in ComfyUI is a dict with a samples tensor. This node takes a list of those dicts and joins them along the batch dimension, producing one samples tensor whose first dimension equals the number of latents you fed it. The count output reports that number. The join expects the latents to be compatible - same channel count, same spatial size - because you can't meaningfully batch a 512Γ512 latent with a 1024Γ1024 one.
The input is marked INPUT_IS_LIST, which is the ComfyUI flag that tells the graph this node's connection is a list of LATENT objects rather than a single one. That's the subtle thing that makes list-based chains work without you having to think about it.
Inputs and outputs
- latents - a list of LATENT (from Latent Batch to Latent List, or from a per-item processing loop).
Outputs: latent (a single batched LATENT) and count (INT).
Where it fits
The classic pattern: generate a batch, split it into a list, run each latent through a per-item step (a per-item strength tweak, an individual inpaint region, per-latent conditioning), then join them back before the sampler or VAE decode so the rest of the pipeline sees a normal batch. Without the join, you'd be stuck re-batching by hand or running the downstream node in a loop. It's the "and put it all back" node that makes the split worth doing.
Installing it
ComfyUI-KikoTools pack: ComfyUI Manager β "ComfyUI-KikoTools" β Install β restart, under ComfyAssets β Latents. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/ComfyAssets/ComfyUI-KikoTools.git
cd ComfyUI-KikoTools
pip install -r requirements.txt
Restart ComfyUI.
Gotchas
Two things to keep in mind. First, mismatched latents fail: if your list mixes different sizes or channel counts, the stack errors - make sure every latent in the list came from the same geometry. Second, count is the tell: if you expected a batch of 4 and got 1, you fed it a list containing a single latent. And a small vocab note: this is a latent-space node; if you're recombining decoded images, the pack's Image List to Image Batch sibling is the one you want.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| latents | LATENT | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | β |
| count | INT | β |