Pt To Int32
The quiet workhorse cast of the Pt-Wrapper dtype family
- tens_a
- TENSOR
Of all the integer casts in ComfyUI-Pt-Wrapper, Pt To Int32 is probably the one you'll touch most in practice - not because it's flashy, but because int32 is the pragmatic middle ground. int16 feels cramped once your values get big, int64 feels like overkill for most data, and int32 is where a lot of real-world datasets and downstream routines actually live.
It's a bare dtype cast: one required input, tens_a (TENSOR), one output (TENSOR), and behind the scenes it's literally tens_a.to(torch.int32). Same values, same shape, new type. You'll reach for it when a node downstream wants 32-bit integers specifically, when you're preparing indices or labels for a dataset or embedding table, or when you need to standardize two tensors so they stop throwing dtype errors at each other.
Same warning applies as to every cast in this family: casting floats to int truncates toward zero. A tensor of normalized 0–1 values becomes a sea of zeros and ones, not the integers you were picturing. Scale first, cast second. And if you came here looking for the index dtype that PyTorch's gather, index_select, and embedding tables actually want by default, that's int64 - see PtToInt64, which is the more common cast for that job.
Install
Via ComfyUI Manager (search "ComfyUI-Pt-Wrapper"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper
Restart ComfyUI afterward. The pack installs a big dependency tree - transformers, datasets, peft, accelerate, scikit-learn, pandas, seaborn, matplotlib, gensim, sentencepiece - so give the first launch a minute. No model files to grab.
Common issues
The main gotcha is assuming the cast does more than it does. It won't round nicely, it won't clip, and it won't convert your values to a sensible range - it truncates and hands you the result. If you need rounding or scaling, do that in a math node before the cast. Otherwise, int32 is one of the safest nodes in the pack to just leave alone and let it work.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| tens_a | TENSOR | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| TENSOR | TENSOR | — |