Nodes/ComfyUI-latent-ops/LatentOperationMulBroadcast
ComfyUI Node

LatentOperationMulBroadcast

The humble scalar multiply that does most of the work

By hnmr293·Created about a year ago·Updated about a year ago· 2
LatentOperationMulBroadcast
    • op
    value1.0000

    Sometimes the most useful node in a box of exotic tools is the plain one. LatentOperationMulBroadcast multiplies every value in a latent by a single number: latent * value. It's not clever. It's not even particularly well-named - "broadcast" here just means "a scalar gets broadcast across the whole tensor." But it's the closest thing this pack has to a volume knob, and you'll reach for it constantly once you're actually manipulating latents by hand.

    What the scalar does

    The whole implementation is:

    def mul(latent, **kwargs):
        return latent * value
    

    where value defaults to 1.0 (a no-op) and ranges from −10000 to 10000 with a fine step. The single input is value (FLOAT, default 1.0).

    Here's the part people forget: a latent is not a dim image, and scaling it is not brightness. Latent values are a compressed, roughly centered distribution - for SD/SDXL they live in a band around ±3, and they don't map to pixels linearly. Multiply the whole latent by 0.5 and you're shrinking the amplitude of what the sampler believes, which downstream behaves more like reducing the strength/energy of the content than "darkening the image." That makes MulBroadcast the natural ingredient for things like latent-strength control, fade-ins, or dialing back an edit before it reaches the decoder. Get your bearings by watching what a VAE-decoded result does as you sweep value from 0 to 1 - it's the fastest intuition you'll build about latent space, and the KB's concepts notes the whole point: the VAE compresses pixels into this space precisely so the diffusion model can work cheaply there.

    The apply step is the real lesson

    MulBroadcast outputs op, type LATENT_OPERATION - a deferred closure, not a result. That's how the entire ComfyUI-latent-ops pack is built: every LatentOperation* node manufactures an operation that something else must execute. The pack itself ships no apply node, so your two options are feeding the op into a consumer that accepts LATENT_OPERATION (Sonar's SonarApplyLatentOperationCFG is the one that actually exists) or writing a small apply node of your own. If you wire op straight into a VAE Decode, you get a type mismatch, not an image - that's the single most common way to bounce off this pack, and it's by design, not a bug you're hitting.

    Install

    Textbook. ComfyUI Manager → "Install Custom Nodes" → search ComfyUI-latent-ops, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/hnmr293/ComfyUI-latent-ops
    

    Restart ComfyUI. There's no requirements.txt and nothing to download - the pack is pure PyTorch, which ComfyUI already bundles. No models, no weights. The author, hnmr293 (of sd-webui-cutoff and llul), built this as his personal latent toolkit; it has essentially no community presence, so don't expect tutorials - expect clean, terse code under hnmr/latent_ops.

    Bottom line

    If you're new to this pack, MulBroadcast is a good first node to actually run: simple math, immediately observable effect, and it teaches you the two things that matter - what scaling a latent does, and that "op" outputs need an apply step. It's the one you'll actually reach for, and there's nothing wrong with that.

    Categoryhnmr/latent_ops

    Inputs (1)

    NameTypeDefaultDescription
    valueFLOAT1.0000-10000–10000

    Outputs (1)

    NameTypeDescription
    opLATENT_OPERATION