Nodes/Vantage-Nodes/Join Latent Batch
ComfyUI Node

Join Latent Batch

Stitch two latent batches into one — safely, without resizing a single pixel

By vantagewithai·Created 8 months ago·Updated 25 days ago· 25
Join Latent Batch
  • latent_a
  • latent_b
  • latent
  • batch_count

When you decode two separate latent batches and want to work with them as one, or when a sampler produced a batch in two chunks that you'd rather have as a single tensor, you need a join. ComfyUI's core doesn't hand you a clean one for latents - which is exactly the gap this node fills. It concatenates two LATENT objects along the batch dimension and hands you the merged result plus a batch count.

The word "strict" in the pack's description matters: unlike the image join, this one refuses to resize anything. Latents are compressed representations with a fixed spatial shape baked in by the VAE, and resizing them in latent space is how you get artifacts. This node checks that both inputs share the same channel/height/width and errors loudly on a mismatch instead of silently producing garbage.

What it needs

  • latent_a, latent_b - both optional. If one is None, you get the other back unchanged (with its batch count). If both are None, you get None and a count of 0. This None-tolerance is what makes it usable as a "merge if present" node in dynamic graphs.

Two outputs:

  • latent - the joined LATENT. Metadata from the first input is preserved, so masks and other latent extras ride along.
  • batch_count - the resulting batch size, e.g. 4 if you joined two 2-image batches. Handy for feeding an INT into a sampler's batch loop or just for sanity-checking that the join did what you expected.

How it behaves

The join is a straight torch.cat along the batch axis - no blending, no averaging, no interpolation. Two batches of 2 become a batch of 4, and each item stays exactly the sample the VAE produced. That's what you want for most workflows: you're not merging images, you're collecting them into one tensor so a single KSampler (or a single VAE decode) can run over them.

The strict shape check is the feature to respect. VAE-encode two images of different resolutions and the shapes won't match - this node will tell you loudly. If you genuinely need mixed sizes in one batch, resize the images first (the pack's image join does the resizing for images; for latents, resizing upstream is the honest path).

Install

Part of Vantage-Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/vantagewithai/Vantage-Nodes.git
pip install -r requirements.txt

or ComfyUI Manager → search "Vantage-Nodes" → Install → restart.

Common issues

  • "Latent shape mismatch" - the two inputs have different C/H/W. This is by design; encode/resize both to the same resolution before joining.
  • Joined batch decodes wrong - if the two latent sources came from different models or different VAEs, the semantics can differ even at the same shape. Join latents that share a provenance.
  • Expecting blending, getting a longer batch - this node concatenates, it doesn't merge spatially. For spatial merging you want an image-level join or a composite, not this.
CategoryVantage/Latent

Inputs (2)

NameTypeDefaultDescription
latent_aoptLATENT
latent_boptLATENT

Outputs (2)

NameTypeDescription
latentLATENT
batch_countINT