Nodes/ComfyUI-latent-ops/LatentOperationSiLU
ComfyUI Node

LatentOperationSiLU

The modern neural-net activation, applied to your latent

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

    SiLU is just Swish with a different name - x * sigmoid(x) - and it's quietly everywhere in modern models. It's the smooth, self-gated activation that replaced ReLU in a lot of recent architectures. LatentOperationSiLU lets you run that same function over your latent: it's roughly ReLU-like for positives, but instead of zeroing negatives it lets them curve gently through zero and fade toward a shallow negative well. If you want a "modern" flavor of nonlinear latent edit, this is the one to reach for - it's the activation your diffusion model probably already speaks internally.

    The mechanism

    def silu(latent, **kwargs):
        return torch.nn.functional.silu(latent * alpha)
    

    One input: alpha (FLOAT, default 1.0) - the input gain shared by every activation node in this pack. The latent is multiplied by alpha, then x * sigmoid(x) runs. That's the entire interface: one float, no slope knob, no variant toggle. The math is smooth and differentiable everywhere, it passes roughly the positive mass through, and it dips slightly negative before flattening toward zero on the negative side - so the information in the negative lobe is compressed rather than annihilated (unlike LatentOperationReLU, which zeros it outright).

    The self-gating property is the interesting bit for latent work: because the sigmoid factor grows with the input, large-amplitude values pass through nearly unchanged while small values get attenuated. Applied to a latent, that's a soft, input-dependent gain - a nonlinear "boost the strong, dampen the weak" curve that's a lot less violent than a hard rectification. If you're shaping a latent distribution by hand, SiLU sits right next to LatentOperationMish (same smooth family, slightly different floor shape - Mish's floor is around −0.31) and LatentOperationSELU (fixed-scale ELU). Of the three, SiLU is the one with the most mainstream pedigree: it's the activation of choice in a huge swath of modern image backbones.

    The op output and the apply trap

    Output is op, type LATENT_OPERATION - a deferred closure, like every node in ComfyUI-latent-ops. The pack builds operations and ships no apply node, so you need a consumer of LATENT_OPERATION (Sonar's SonarApplyLatentOperationCFG is the one that exists) or your own apply node. Plugging op straight into a VAE Decode yields a type mismatch - the pack's universal first trap, by design. Nothing here applies itself.

    Install

    The standard drill. ComfyUI Manager → search ComfyUI-latent-ops, or:

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

    Restart. No requirements.txt, no model downloads - pure PyTorch, which ComfyUI already ships. This is hnmr293's private latent toolkit (same author as sd-webui-cutoff and llul); the community footprint is essentially zero, so latent_ops/functions.py is your documentation. Everything registers under hnmr/latent_ops.

    Categoryhnmr/latent_ops

    Inputs (1)

    NameTypeDefaultDescription
    alphaFLOAT1.0000-10000–10000

    Outputs (1)

    NameTypeDescription
    opLATENT_OPERATION