LatentOperationELU
The activation that keeps negatives alive
- op
ReLU-style zeroing is fine until it isn't. If you've ever clamped a latent's negatives to zero and watched the output lose texture - because "remove the negative values" and "flatten everything below zero to a hard line" are not the same thing - ELU is the alternative. It keeps negative values alive but curves them smoothly toward a floor, so information survives the cut. For latent manipulation, that soft floor is often exactly what you want.
ELU is one of the activation nodes in hnmr293's ComfyUI-latent-ops pack. Like every Operation node there, it doesn't touch a latent itself - it builds a deferred recipe.
How it works
The node captures alpha and builds a closure that runs torch.nn.functional.elu(latent * alpha) when applied. Positive values pass through (roughly) linearly; negative values curve smoothly toward -1 instead of snapping to zero. The alpha input pre-scales the latent before the activation - at 1.0 you get plain ELU, and larger values make the whole curve react faster. There's no kink at zero, which is the whole point: it's the smooth, information-preserving alternative to a hard floor.
What matters
alpha- FLOAT, default 1.0, range -10000 to 10000, step 0.0001. Pre-scale of the input.op- the only output. ALATENT_OPERATION- a deferred operation, not a result.
That op output is the pack's recurring trap: it won't connect to a latent input, and this pack ships no node that applies an op. You need a consumer that accepts the LATENT_OPERATION type, or a small custom apply node (op(latent["samples"])). Without one, the node does nothing.
Installing it
No extra deps, no model downloads - ComfyUI Manager → search "ComfyUI-latent-ops" → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/hnmr293/ComfyUI-latent-ops
Restart ComfyUI; it's under hnmr/latent_ops.
Troubleshooting
If you expected hard zeroing and got a soft negative curve, that's ELU working as designed - reach for ReLU-style behavior if you truly want to kill negatives. If you need the fully smooth variant with no slope change at all, that's LatentOperationCELU. And if your result looks darker or flatter than you expected after the soft floor, remember every value below zero is being pulled toward -1 - pair ELU with a Clamp or NormalizeMinMax if you then feed the latent to a preview node that expects a bounded range.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| alpha | FLOAT | 1.0000-10000–10000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| op | LATENT_OPERATION | — |