Latent Batch to Latent List
Split a Latent Batch Into a List, One Latent at a Time
- latent
- latents
- count
Latent Batch to Latent List is the latent-world version of the pack's image batch splitter: it takes a batched LATENT tensor and splits it into a list of individual latent dicts. If you generate a batch of 4, decode later per-item, or want to run a per-latent process on each of a stack, this is the node that un-stacks them.
How it works
A latent batch is a dict ({"samples": tensor}) where the samples tensor has a batch dimension - [B, 4, H/8, W/8] in standard ComfyUI latent format. This node slices along that first dimension and returns each slice as its own latent dict, preserving the samples structure that downstream nodes expect. You get a list of B separate latents and a count INT telling you how many there are.
The detail that matters: the output is marked as a list output (latents), so ComfyUI's routing knows the downstream connection is a list of LATENT objects, not a single batched latent. If a node expects a single latent and complains, that's the "you need the batch, not the list" situation, and the pack's Latent List to Latent Batch node is the mirror that puts it back together.
Inputs and outputs
- latent - a batched LATENT (e.g., from Empty Latent Batch with
batch_size > 1).
Outputs: latents (list of LATENT) and count (INT).
Where it fits
Honest take: most of the time you don't need this, because most ComfyUI samplers happily consume a whole batch and return a whole batch. You reach for it when a node in your chain is per-latent only - inpainting a specific item, checking each latent's dimensions, feeding a per-item prompt. It's a plumbing node, and it's fine that it's a plumbing node; it's there so you don't have to hand-slice tensors in a Python node.
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
The count output is your diagnostics: if it says 1, your input wasn't batched - you're splitting a single latent into a list of one, which is harmless but pointless. And remember that splitting happens before decode, so each list item is still a latent; if you wanted individual decoded images you'd split the image batch instead (see Image Batch to Image List). Pair this with Latent List to Latent Batch and you can split, process per-item, and rejoin without ever leaving latent space.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| latents | LATENT | β |
| count | INT | β |