Nodes/ComfyUI_agilly1989_motorway/LatentAdd_motorway_edition
ComfyUI Node

LatentAdd_motorway_edition

Element-wise latent addition — advanced math, piped

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

LatentAdd_motorway_edition wraps core's LatentAdd, which adds two latents together element-wise and returns the sum. The motorway edition reads both inputs from pipe keys and writes the result back to a key. There is no configuration beyond the three keys - the node does one thing, and that thing is a tensor addition on the compressed representation.

What adding latents is actually for

Latents are tensors - grids of numbers that the VAE compresses images into - so "adding" them is arithmetic, not compositing. Where does that get you? Mostly in advanced workflows where you're manipulating the noise/feature representation directly: averaging or combining two sampled latents to merge their composition, nudging a latent toward or away from another one (which is a crude cousin of the operations in LatentApplyOperation), or building composite latents that don't correspond to any single image. It's a genuinely advanced tool - if you can't say why you're adding the tensors, you probably don't need to be - and it sits in the pack's latent/advanced category for that reason.

The inputs are INPUT_samples1_key (default "samples1") and INPUT_samples2_key (default "samples2"); the output is OUTPUT_LATENT_key (default "LATENT"). Two things worth knowing before you wire it up:

  • Both inputs must be latents of the same shape. Adding a 1024×1024 latent to a 512×512 one isn't a clever blending trick; it's a shape mismatch that throws an error.
  • The result replaces whatever is under "LATENT" in the pipe. If you still need the originals, don't let both feed a key that something else reads.

Only output socket is MOTORWAY 🚌💨; read the summed latent out via a Motorway AxB ramp when you want to sample or decode it.

Motorway notes

Two keys in, one key out. The signature error - 'MotorwayClass' object has no attribute 'hash_' - means a key you referenced was never written into the pipe, and with two inputs that's usually a mismatch between what you typed and what an upstream node actually stored. Keys are exact and case-sensitive.

Install and reality check

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.

And the pack-wide context: one-developer beta, README-frank about breakage ("IF THINGS BREAK ITS BECAUSE I BROKE IT"), and the current repo HEAD comments out the _motorway_edition registration mid-refactor - so a fresh clone may not even load this node. Latent addition is niche even in core, so the wrapper's appeal is doubly conditional: you have to both want latent arithmetic and want to do it through a pipe. If either is false, the stock LatentAdd is the same math with a socket.

Categoryagilly1989 Nodes/Motorway-ed/latent/advanced

Inputs (4)

NameTypeDefaultDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨
INPUT_samples1_keySTRINGsamples1
INPUT_samples2_keySTRINGsamples2
OUTPUT_LATENT_keySTRINGLATENT

Outputs (1)

NameTypeDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨