ComfyUI Node

Pt Sin

For wave math, oscillators, and signal-style data

By HowToSD·Created about a year ago·Updated about a year ago· 7
Pt Sin
  • tens_a
  • TENSOR

Pt Sin applies the sine function to every element of a tensor. If that sounds like the world's smallest feature, it is - but it's one of those building blocks that earns its place. In the ComfyUI-Pt-Wrapper world, sine shows up whenever you're generating or manipulating signal-like data in a graph: wave patterns, oscillating schedules, positional encoding components for the Transformer-from-scratch workflows the pack's README highlights, or just transforming a tensor element-wise to test a downstream node. You won't use it every day. When you need it, you'll be glad it's one node instead of a Python detour.

What it actually does

It's a one-liner wrapper around torch.sin(tens_a). One TENSOR in, one TENSOR out, same shape, every element replaced by its sine. The implementation notes that the input is expected to be angles in radians, not degrees. That's the classic gotcha with every trig function: feed it degrees and the output is wrong in a way that's easy to miss unless you're expecting specific values. If your angles are in degrees, you need to convert - multiply by π/180 - before this node, or you'll get correct-looking but wrong numbers.

Only one input:

  • tens_a - the tensor to take the sine of. Any numeric dtype.

Output is a TENSOR of the same shape and dtype, ready to wire into the next math node, display node, or model input.

How to install it

It ships in the ComfyUI-Pt-Wrapper pack. ComfyUI Manager: search ComfyUI-Pt-Wrapper, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper

Restart after. The pack's requirements.txt is the heavy training stack (transformers, datasets, accelerate, peft, gensim, sentencepiece, plus pandas/scikit-learn/scipy) - a lot of dependency for a sine node if that's all you wanted, but it comes bundled with the pack.

Gotchas

Radians, radians, radians. That's the whole ballgame here. torch.sin doesn't check units; it just computes. An angle of 90 gets interpreted as 90 radians, which is not 1. Convert first.

Also worth knowing: this operates element-wise and keeps the dtype. Feed it an int tensor and you get sine values in whatever the input's numeric behavior gives you - usually you'll be feeding floats, and for trig math you should be.

CategoryData Analysis

Inputs (1)

NameTypeDefaultDescription
tens_aTENSOR

Outputs (1)

NameTypeDescription
TENSORTENSOR