LatentApplyOperation_motorway_edition
Apply math to your latent — add, multiply, sine, cosine — via keys
- MOTORWAY 🚌💨
- MOTORWAY 🚌💨
LatentApplyOperation_motorway_edition wraps core's LatentApplyOperation, which applies a mathematical operation - add, subtract, multiply, divide, cosine, sine - to a latent. The motorway edition pulls the latent and the operation from pipe keys and writes the result back to a key.
The operations, and what they're good for
This is latent arithmetic as a menu. The non-linear ones (cosine, sine) are the interesting entries: applied to the latent's values, they produce periodic distortions that some people use for creative texture-bending and noise shaping in experimental workflows. The linear ones (add, subtract, multiply, divide) are cruder - adjust overall magnitude, or combine with a second latent's contribution. None of this is a stable, mainstream technique; it lives in latent/advanced/operations because it's for people who are deliberately doing something weird with the representation. If you can't say why you're sine-ing your latent, skip it - the results are often visually broken on purpose.
The operation input is a STRING in this wrapper - a key field. In core it's a dropdown; here the value comes from the pipe, so whatever writes the "operation" key decides the operation. The available strings match core's menu: "add", "subtract", "multiply", "divide", "cosine", "sine". A typo here produces a silent failure or a meaningless math op rather than a helpful dropdown, so this is the field to double-check.
Set:
INPUT_samples_key(default"samples") - the latent.INPUT_operation_key(default"operation") - which operation to apply.OUTPUT_LATENT_key(default"LATENT") - where the result lands.
Only output socket is MOTORWAY 🚌💨; read the result out via a Motorway AxB ramp when you want to sample or decode it.
Motorway notes
Both inputs are key fields, so both must exist in the pipe before this node runs. The signature error - 'MotorwayClass' object has no attribute 'hash_' - means a key you referenced was never written; with "operation" coming from a string key, a spelling mismatch is the usual culprit.
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.
Pack-wide reality check: 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. This is niche-in-core wrapped in beta - if latent math isn't already a deliberate part of your workflow, the stock LatentApplyOperation is the same experiment with a socket and a proper dropdown, which is honestly the better place to try it.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — | |
| INPUT_samples_key | STRING | samples | — |
| INPUT_operation_key | STRING | operation | — |
| OUTPUT_LATENT_key | STRING | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — |