Pt Cos
Cosines for your tensor math, radians included
- tens_a
- TENSOR
Pt Cos computes the cosine of every element in a tensor, and there is not a single surprise hidden in it. It's torch.cos(tens_a) with the pack's usual thin-wrapper styling. Input a tensor, get back a same-shape tensor of cosines, element-wise.
The one thing worth knowing before you reach for it: the input is expected in radians, not degrees. This is the classic trig gotcha and it's the difference between a cosine that behaves and nonsense values. If your data is in degrees, cos(90) will give you the cosine of 90 radians, which is about 0.624 - not the 0 you probably wanted. The pack doesn't ship a degrees-to-radians converter, so you'd build that yourself (or just keep everything in radians; most of the pack's workflow examples do).
When it matters
This is a math-operations node in a pack whose whole point is doing PyTorch math visually, so the honest placement is: it's a brick in the wall, not a feature. Real uses: signal processing on tensors (the pack's data-analysis heritage), periodic feature engineering, or positional-encoding math if you're hand-rolling a transformer graph - though for that you'd more likely want the trig cluster (PtSin, PtCos, PtTan, PtCosh...) assembled together rather than this node alone.
One genuinely nice property: unlike the bitwise nodes, this one accepts float tensors, so it's friendly to data straight out of PtFromNumpy or an image pipeline. Outputs are float, same shape, no surprises. The pack even pairs it with PtCosh if your math wanders into hyperbolic territory.
Installing it
Part of ComfyUI-Pt-Wrapper (Hide Inada / HowToSD). ComfyUI Manager → search "ComfyUI-Pt-Wrapper" → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper
Watch the dependency weight: the pack pulls pandas, scipy, scikit-learn, transformers, datasets, gensim, peft, accelerate, seaborn and matplotlib. If Manager's install fails, pip install -r requirements.txt in the clone. No model files needed for pure math nodes like this one.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| tens_a | TENSOR | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| TENSOR | TENSOR | — |