LatentAdd_AS
Add two latents together
- samples_to
- samples_from
- LATENT
LatentAdd_AS adds two latent tensors together, element by element, and outputs a LATENT. It's latent-space arithmetic of the most literal kind - no blending weights, no masks, no options. Just samples_to + samples_from, handed back as a new latent.
This is one of the several latent-manipulation nodes in flyingshutter's As_ComfyUI_CustomNodes pack, alongside LatentMix_AS (a weighted blend) and LatentMixMasked_As (a masked blend). Like everything in the pack, it's dependency-free: no requirements.txt, no models, nothing but the torch that ComfyUI already runs on.
How it works
A latent isn't an image - it's the compressed, multi-channel tensor that a VAE encoder produces and a diffusion model works in (the KB's concepts coverage has a good explainer on this: the VAE is the bridge between pixel space and latent space). This node clones the first latent's metadata, then replaces its samples tensor with samples_to + samples_from, summed per-channel, per-pixel. Since addition is commutative, either input order gives the same result.
What that means practically: the output is a latent whose values are the sum of two latents' values, which is not the same as averaging two generated images. This is a tool for experimenters who understand latent space, not a compositing shortcut.
The inputs
samples_to- firstLATENTinput.samples_from- secondLATENTinput.
That's it. The output is a LATENT with the same shape as the inputs.
Where you'd use it
Latent addition shows up in creative/experimental pipelines: adding a noise-like latent to shift a generation, combining a base latent with a "direction" latent to push the output in a particular direction, or working out of a latent arithmetic playbook where you add and subtract latents to explore semantic directions. It's also handy in research-style workflows where you want to inspect what summing two encoded images actually does before you decode the result.
One honest warning: outside of structured experiments, adding two full latents often produces something that looks like heavy noise after decoding, because VAE latents aren't normalized the way you'd hope for casual mixing. If what you actually want is a gentle blend, LatentMix_AS with a low weight is usually the saner choice.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/flyingshutter/As_ComfyUI_CustomNodes
Restart ComfyUI and it's under ASNodes (or ComfyUI Manager → search "As_ComfyUI_CustomNodes").
Common issues
- Shape mismatch. The two latents must have matching sample dimensions; adding a 64×64 latent to a 128×128 one errors out. If your latent came from a different resolution, upscale/resize before adding.
- Different VAE/model spaces. Latents from different models aren't directly comparable - adding a Flux latent to an SDXL latent is like adding apples and oranges. Keep inputs from the same model (and ideally the same VAE; see the KB's notes on shared latent spaces).
- Noise-looking results. Expected for naive addition, as above. If that's not what you want, reach for a weighted blend instead.
It's a raw operator for people who know what they're doing with latent space. If that's you, it works as advertised; if you just wanted to fade between two images, grab the blend node instead.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| samples_to | LATENT | — | |
| samples_from | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |