Nodes/ComfyUI-latent-ops/LatentOperationSoftplus
ComfyUI Node

LatentOperationSoftplus

The smooth ReLU that never quite zeroes out

By hnmr293·Created about a year ago·Updated about a year ago· 2
LatentOperationSoftplus
    • op
    beta1.0000

    Softplus is the answer to the question "what if ReLU was differentiable and polite about it?" Where ReLU snaps to zero the moment a value goes negative, softplus - log(1 + exp(x)) - glides down smoothly and approaches zero without ever quite landing on it. It's the activation function you met once in an ML course and never touched again. This node lets you aim it at your latent tensor.

    It's part of hnmr293/ComfyUI-latent-ops, a toolbox of math ops for LATENT by hnmr293, the dev behind sd-webui-cutoff and the LLuL latent upscaler. The whole pack is a grab-bag of these function nodes - sigmoid, tanh, gelu, mish, the works - sharing one codebase and one install.

    What it computes

    One line in the source: softplus(latent * beta). Every latent value gets scaled by beta, then pushed through log(1 + exp(x)). The landmarks:

    • beta = 1 (the default): plain softplus. Positive values grow nearly linearly; negative values sink toward zero but always stay a hair above it - softplus(0) is ln(2) ≈ 0.69, and even softplus(-100) is about 3.7e-44.
    • beta > 1: steepens the curve, so it behaves more like ReLU with a harder knee.
    • beta < 1: flattens everything toward a gentle ramp.

    So the practical effect on a latent is a monotonic squish that floors the negatives instead of hard-clipping them. If you want to kill the negative half of your latent's range but keep the transition smooth - no harsh cut, no value forced to exactly zero - this is the curve. It's also a genuinely useful building block when you're porting a formula from a paper into a graph: softplus shows up in continuous-discrete noise schedulers and score-based derivations all the time, and having it as a named node beats hand-rolling it.

    The input, output, and the catch

    The one input you set is beta (FLOAT, default 1.0). Output is named op, typed LATENT_OPERATION - and here's the thing you need to know before you build a workflow around this node.

    That op output is not a latent. It's a callable - a function object that would apply softplus if something actually invoked it. The node builds the operation and hands you a handle to it. As of the last commit, the pack ships no node that consumes a LATENT_OPERATION, so on a stock install there's nothing to plug op into. You can't drag it into a KSampler or a VAEDecode; the input socket for that type simply doesn't exist in this pack yet.

    That's the honest picture: these function nodes are library primitives waiting for an apply node (or another pack that declares the same custom type). If your goal is "make my latent non-negative right now," you can get that effect today with a ClampMin at zero or a LatentMath-style op - no dependency needed. Reach for this node when you want this exact smooth function as a reusable handle in a graph that can consume it.

    Install

    Same for 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, nothing beyond PyTorch (which you already have). Look for the nodes under hnmr/latent_ops.

    Common issues

    • "The output won't connect to anything." Expected - it's a LATENT_OPERATION callable, not a latent. Check whether you actually have a consumer for that type before wiring a workflow.
    • "My latents all turned positive-ish." That's softplus being softplus - it's a monotonic curve that maps everything to positive territory. If you wanted a centered squeeze instead, tanh or a normalized op is the better tool.
    • Quiet repo: the pack had one active burst (April 2025) and has barely moved since. Don't expect rapid fixes or new apply nodes.
    Categoryhnmr/latent_ops

    Inputs (1)

    NameTypeDefaultDescription
    betaFLOAT1.0000-10000–10000

    Outputs (1)

    NameTypeDescription
    opLATENT_OPERATION