Nodes/ComfyUI_agilly1989_motorway/LatentBatch_motorway_edition
ComfyUI Node

LatentBatch_motorway_edition

Glue two latents into one batch, inside the pipe

By agilly1989·Created 2 years ago·Updated about a year ago· 7
LatentBatch_motorway_edition
  • MOTORWAY 🚌💨
  • MOTORWAY 🚌💨
INPUT_samples1_keysamples1
INPUT_samples2_keysamples2
OUTPUT_LATENT_keyLATENT

LatentBatch_motorway_edition wraps core's LatentBatch, which concatenates two latents along the batch dimension so they become one latent with both images in it. The motorway edition reads the two inputs from pipe keys and stores the combined batch back under a key.

Why batch latents together

ComfyUI processes tensors in batches, and many nodes - a sampler, a ControlNet apply, an upscaler - will happily operate on a batch of several images at once. LatentBatch is how you get from "two separate latents" to "one batched latent." The classic use is generation: empty two latent slots, batch them, and sample both simultaneously so they share the same denoising pass (and, with the right seed handling, the same starting noise). It's also the assembly step before nodes that want a whole batch as a single input.

There's exactly one hard requirement: the two latents must match in everything except the batch dimension - same width, same height, same channels. Batch-concatenating a 512×512 latent with a 1024×1024 one isn't a resize trick, it's an error. If your inputs differ in size, fix that (e.g. with LatentCrop) before the batch node.

The inputs are INPUT_samples1_key (default "samples1") and INPUT_samples2_key (default "samples2"); the output is OUTPUT_LATENT_key (default "LATENT"). Only output socket is MOTORWAY 🚌💨, so read the batched latent out via a Motorway AxB ramp when you want to sample or decode it. And since the result overwrites "LATENT" in the pipe, don't let both originals sit under keys that something else reads expecting singles.

Motorway notes

Two keys in, one key out, no widgets. The signature failure - 'MotorwayClass' object has no attribute 'hash_' - means a key you referenced was never written into the pipe; with two inputs, check both upstream keys. Keys are exact and case-sensitive, as everywhere in this pack.

Install and the standing caveats

cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway

Restart ComfyUI, or install via ComfyUI Manager. No pip deps, no model files - a tensor concatenation.

Pack-wide reality check, because it applies fully here: one-developer beta, README-explicit about breakage, and the current repo HEAD comments out the _motorway_edition registration mid-refactor, so a fresh clone may not even load this node. LatentBatch is a genuinely useful utility in core, but the wrapper only pays off if you're already routing latents through keys - otherwise the stock node concatenates with less ceremony.

Categoryagilly1989 Nodes/Motorway-ed/latent/batch

Inputs (4)

NameTypeDefaultDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨
INPUT_samples1_keySTRINGsamples1
INPUT_samples2_keySTRINGsamples2
OUTPUT_LATENT_keySTRINGLATENT

Outputs (1)

NameTypeDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨