LatentOperationMish
The smooth, self-regularizing activation for latents
- op
Mish is the activation function that never quite got famous. From the 2019 paper "Mish: A Self Regularized Non-Monotonic Activation Function", it's x * tanh(softplus(x)) - smooth everywhere, unbounded above, and with a tiny negative floor around −0.31 instead of a hard zero. Applied to a latent, it's a gentle nonlinear reshape: it lets negatives survive at low amplitude and keeps positives flowing without the brutal cliff that ReLU drops off. If you're experimenting with activation transforms on latents, this is the one that's least likely to blow your image up.
How it works
The implementation is a single call: torch.nn.functional.mish(latent * alpha).
The only input is alpha (FLOAT, default 1.0), and like every activation node in hnmr293/ComfyUI-latent-ops, alpha is an input gain - the latent gets multiplied by it before Mish runs. alpha = 1 is identity-gain; crank it and you drive the curve harder into its nonlinear regime. There's no other parameter, no slope knob, no epsilon. One float, that's the whole node.
What makes Mish interesting versus the pack's ReLU: a hard ReLU collapses the entire negative half of the latent distribution to exactly zero, which is a violent edit to a zero-mean distribution - you'd be zeroing something like half of all values. Mish instead pushes negatives into a shallow negative well, so the distribution stays roughly balanced while still being reshaped. That "self-regularizing" property from the paper (it keeps activations from blowing up the gradient flow in deep nets) translates, loosely, to a latent edit that tends to preserve overall character rather than eviscerate it.
The catch - the apply step
Like every LatentOperation* node in this pack, Mish doesn't return an edited latent. It returns op, typed LATENT_OPERATION - a deferred Python callable describing the transform. The pack is a builder of operations, not a renderer of them; there's no apply node inside ComfyUI-latent-ops. You feed the op into something that consumes LATENT_OPERATION (Sonar's SonarApplyLatentOperationCFG is the known consumer), or you write a tiny apply node yourself. Wire op into a VAE Decode and ComfyUI throws a type mismatch - that's the #1 way beginners bounce off this pack, and it's not your fault, it's just how the toolkit is designed.
Where it fits
This whole pack is the private workbench of hnmr293 - the same person who wrote sd-webui-cutoff and llul - and the vibe is "precise, unglamorous, zero hand-holding." No tutorials exist for it; the community signal is essentially nil (search reddit for "latent-ops" and you get nothing). So treat Mish as an experimental flavor: reach for it when you want a smooth, symmetric-ish nonlinearity on your latent - say, before an interpolation or a CFG-style blend where a hard ReLU would shove the distribution off-center - and pick LatentOperationSinh if you want something steeper, or LatentOperationSiLU for the modern neural-net standard.
Install
Unremarkable and quick. ComfyUI Manager → 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 downloads - the pack is pure PyTorch plus torch.nn.functional, which ComfyUI already bundles. Everything registers under hnmr/latent_ops. If the source ever disagrees with the README (it does, on a couple of nodes), the source wins - it's four small files and worth a skim.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| alpha | FLOAT | 1.0000-10000–10000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| op | LATENT_OPERATION | — |