Activation (DEPRECATED)
Nine activation functions in one node — only two of the knobs do anything
- tensor
- output
CdlActivation is the "squash it through a nonlinearity" node. Neural networks are useless stacks of linear operations without activations between layers - no matter how deep you go, a chain of matrix multiplies is still just one linear map. This node applies the activation function of your choice to a tensor so you can see, or build, that nonlinearity by hand in the graph.
How it works
It's a thin wrapper over PyTorch's activation functions. Pick one from the func dropdown and the node applies it element-wise to your tensor and hands back the result. The nine options are relu, sigmoid, tanh, leaky_relu, elu, gelu, silu, softmax, and softplus - that's basically the textbook starter kit from Dive into Deep Learning, which this pack is a port of.
Here's the part worth understanding before you start turning dials: two of the four widgets are per-function. The dim input only affects softmax (it chooses which dimension to normalize over), and negative_slope only affects leaky_relu (it sets the slope of the negative region, default 0.01). Change dim while relu is selected and nothing happens - it silently ignores you. That's by design, not a bug, but it surprises people the first time.
Inputs and output
tensor- thecdlTensoryou're activating.func- the dropdown (defaultrelu).dim- softmax only; default-1(the last dimension), which is what you usually want anyway.negative_slope- leaky_relu only; default0.01.
The single output is output, another cdlTensor, ready to feed the next layer.
What you'll actually reach for
relu/gelu/silu- the modern defaults for hidden layers. GELU and SiLU are what transformers use; ReLU is the classic.softmax- technically an activation, but you'll mostly use it as the final head that turns logits into a probability distribution across classes.sigmoid- when you want a 0–1 output, like a single-class probability.
If you're building a small model by hand (say, after a CdlConv2d), this is the node you'd drop between layers. If you're doing image generation, though, this isn't your tool - cdlTensor ports only talk to other ComfyDL nodes, and this pack is for learning deep learning fundamentals, not diffusing images.
Installing it
It's part of the ComfyDL pack, so install once and you get all 106 nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/Cynthia-lxx/ComfyDL
pip install -r ./ComfyDL/requirements.txt
Then restart ComfyUI, or search "ComfyDL" in ComfyUI Manager. The one extra requirement is matplotlib; everything else is torch, which ComfyUI already ships.
Gotchas
dimandnegative_slopedo nothing unless the matching function is selected - don't assume they're global knobs.- The README example workflows are the best tutorial you'll get; this pack is niche and there's basically zero community chatter about it, so the docs are the docs.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| tensor | TENSOR | — | |
| func | COMBO | relu | 9 options: relu, sigmoid, tanh, leaky_relu, elu, gelu, +3 |
| dim | INT | -1-4–4 | — |
| negative_slope | FLOAT | 0.010–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | TENSOR | — |