Ptf Softplus
ReLU's smooth, never-quite-zero cousin
- PTCALLABLE
Softplus is what you get when you round off the sharp corner of ReLU: log(1 + exp(x)), a smooth function that's roughly zero for very negative inputs and roughly linear for large positives. Ptf Softplus packages it as a callable component - no inputs, one PTCALLABLE output - for the pack's no-code model building. It's the activation you reach for when you want ReLU's shape without its kink, or when you need an output that stays strictly positive (it's a classic choice for turning a score into a variance or scale parameter).
How it works
The node returns torch.nn.functional.softplus. As a callable it slots into Pt Apply Function (tensor + callable → transformed tensor) or any model node that accepts a closure, applying element-wise to whatever passes through. Compose it after a linear layer and you get a smooth, everywhere-differentiable, strictly-positive output - properties ReLU lacks (kink at zero, exact zeros) and that some downstream math, like log-scale or variance-style parameters, really wants.
For the record, PyTorch's softplus also has a beta/threshold tunable in the function signature, but this node hands you the default call with no knobs exposed. You get the plain vanilla version, and for 99% of use that's the right one.
The one output
- PTCALLABLE - the softplus function. No inputs.
Choosing among the smooth family: Ptf SiLU is the modern general-purpose pick; softplus is the one you want specifically when strict positivity matters. If you only need "roughly ReLU," ReLU itself is simpler - this node earns its place on the strict-positivity use case.
Where people get burned
- The callable trap, again: no tensor input on this node; apply it via Pt Apply Function or a closure socket.
- Expecting hard zeros: softplus never quite reaches zero, by design. If your downstream logic checks
== 0, it'll fail. - It's a function, not an
nn.Module- use the pack's layer nodes when a module is explicitly required.
Installing it
It's in ComfyUI-Pt-Wrapper:
- ComfyUI Manager → search "ComfyUI-Pt-Wrapper" → Install → restart.
- Or
cd ComfyUI/custom_nodes && git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapperand restart.
The pack installs a heavy ML stack (transformers, datasets, peft, accelerate, scikit-learn, scipy, gensim, sentencepiece), so first boot is slow. No model downloads needed. It's a niche educational pack by HowToSD with almost no community footprint; the repo's docs/reference/ is your best reference.
Inputs (0)
No inputs
Outputs (1)
| Name | Type | Description |
|---|---|---|
| PTCALLABLE | PTCALLABLE | — |