Nodes/ComfyUI-latent-ops/LatentOperationSoftsign
ComfyUI Node

LatentOperationSoftsign

The tanh that takes its time at the edges

By hnmr293·Created about a year ago·Updated about a year ago· 2
LatentOperationSoftsign
    • op
    alpha1.0000

    Tanh gets all the love as "the smooth clamp," but softsign is the quieter cousin that does the same job without the panic. Both squash values into the (-1, 1) range. The difference is in the tail: tanh asymptotes exponentially, slamming into its limits hard; softsign - x / (1 + |x|) - approaches its limits polynomially, which is a long, slow glide instead of a snap. If you want to bound your latent but keep the extremes from getting mushed flat, softsign is the curve.

    It's one of the function nodes in hnmr293/ComfyUI-latent-ops, the latent-math toolbox by hnmr293 (the dev behind sd-webui-cutoff and the LLuL latent upscaler). Same family as the tanh, gelu, sigmoid and mish nodes in the pack: same category, same install, same one-line implementation each.

    What it computes

    The source is softsign(latent * alpha) - scale every value by alpha, then push through x / (1 + |x|). Landmarks:

    • alpha = 1 (default): plain softsign. Near zero it's basically linear; out toward ±10 you're at about ±0.9; you'd need ±100 to hit ±0.99. The saturation is real, it just takes forever to get there.
    • alpha > 1: compresses that timeline, pushing more of the tensor toward the saturated ends.
    • alpha < 1: stretches the linear region even further - a very gentle fade.

    The practical difference from tanh: softsign preserves more signal in the tails because its gradient stays meaningfully above zero much farther out. Tanh will crush a strong outlier into "basically 1"; softsign lets it keep a little of its identity. For latent-shaping tricks where you want bounding without a hard squash, that's the argument for this node over its more famous sibling.

    Input, output, and the honest catch

    One input: alpha (FLOAT, default 1.0). Output is named op, typed LATENT_OPERATION.

    And here's the thing to know up front: op is not a latent. It's a callable - a function handle the node builds and hands back. As of the last commit this pack has no node that accepts a LATENT_OPERATION as input, so on a stock install there's nowhere to plug that output. It won't connect to a KSampler or a VAEDecode; the socket for that custom type just isn't shipped yet. These function nodes are primitives for a future "apply" node (or for another pack that declares the same type), not drop-in latent processors.

    So set your expectations: if "squash my latent to (-1,1) right now" is the goal, you can approximate it today with a Mul and a Clamp from core ComfyUI - no install needed. Reach for this node when you want the exact softsign curve as a named, reusable handle, or when you're porting a formula from a paper and softsign is written in it (it shows up in some normalization and activation literature).

    Install

    Standard, and shared by the whole pack. ComfyUI Manager - search "ComfyUI-latent-ops" - or:

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

    then restart ComfyUI. No requirements.txt, no model downloads, no dependencies beyond PyTorch. Nodes appear under hnmr/latent_ops.

    Common issues

    • "My op output is a dead end." Expected, not a bug - it's a LATENT_OPERATION callable and the pack doesn't yet ship anything that consumes it.
    • "It barely changes my image." With alpha at 1, softsign near zero is almost identity, and latent values cluster around zero. If you want a visible effect, raise the alpha - the node is a tool, not a magic preset.
    • Repo's quiet: one build burst in April 2025, little movement since. Check the commit history before betting a workflow on it.
    Categoryhnmr/latent_ops

    Inputs (1)

    NameTypeDefaultDescription
    alphaFLOAT1.0000-10000–10000

    Outputs (1)

    NameTypeDescription
    opLATENT_OPERATION