Pt Abs
Absolute value, minus the drama
- tens_a
- TENSOR
Pt Abs does exactly one thing: turns every element of a tensor into its absolute value. Negatives become positive, positives stay put, zeros stay zero. It's the most boring node in the pack, and that's fine - you're not here for Pt Abs, you're here because you're building a PyTorch pipeline in ComfyUI and somewhere down the line you needed magnitude.
It's one of the math-operation wrappers in ComfyUI-Pt-Wrapper (HowToSD's 200-node no-code PyTorch pack, the spin-off of ComfyUI-Data-Analysis), sitting alongside the trig functions, add, and the rest. As a standalone you'd rarely build a workflow around it. But as a building block it has real jobs: computing an L1-style magnitude (mean of abs values as a simple loss or penalty), measuring how far something is from zero regardless of direction, or cleaning up data where sign doesn't matter.
How it works. One input, tens_a (any TENSOR); one output, TENSOR. The implementation is tens_a.abs(). Element-wise, same shape, same dtype. There are no settings, no gotchas in the node itself.
Where you'll actually meet it: inside loss and regularization math. An L1 loss is literally mean(abs(predicted - target)), so a workflow computing a penalty will chain a subtract node into Pt Abs and then a mean/reduce node. If you're reading the pack's docs and see L1 mentioned, this is the node behind it. Outside training, abs is also how you compute error or residual magnitudes for evaluation - "how wrong is the model on average" is an abs-shaped question.
The honest assessment: you will never google this node on its own, and that's the point. It exists so the graph has the operation available without needing a Python snippet. If you don't need abs, skip it - there's no hidden feature to unlock. If you do need it, it's the right tool and it will never surprise you. The only adjacent trap is in the workflow, not the node: abs on a tensor whose sign matters (gradients, signed deltas, attention scores where direction is information) will silently flatten the information you needed. Use it when magnitude is the point, not as a lazy way to make numbers "look positive."
Install: ComfyUI Manager → "ComfyUI-Pt-Wrapper", or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper
then restart. No model downloads; the pack's heavy requirements.txt (transformers, sklearn, sentencepiece, pinned gensim) is the only install cost.
Troubleshooting: If abs output looks wrong, check what you fed it - it preserves shape and dtype, so any surprise is upstream (a cast node, a wrong wire). NaN in, NaN out - abs doesn't rescue NaNs; fix the source. And if you expected a scalar (a single loss number) and got a tensor, you still need a reduce/mean step after abs - abs is per-element, not a sum.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| tens_a | TENSOR | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| TENSOR | TENSOR | — |