Pt Bitwise Or
How you set flags instead of checking them
- tens_a
- tens_b
- TENSOR
In the bitwise family, AND is how you test flags and OR is how you set them. Pt Bitwise Or wraps torch.bitwise_or(tens_a, tens_b), producing a tensor where each output bit is 1 if either input bit is 1. If you've packed a set of boolean features into an integer (see PtBitwiseLeftShift for the packing side), OR is what combines those fields into one value, or flips a specific flag on without touching the others.
It's another one-line wrapper - there's no hidden logic, no state, no surprise parameters. The value of the whole bitwise cluster is that you can build these data transforms visually instead of dropping into Python.
Inputs
tens_a- firstTENSOR, integer dtype.tens_b- secondTENSOR, same shape, same integer dtype.
Output: one TENSOR with a | b element-wise. That's all of it.
When you'd actually reach for it
Realistically? Only if you're doing classic data-analysis work in ComfyUI - building feature vectors, compressing categorical one-hots, or encoding multi-label targets. The pack's headline examples (ResNet on CIFAR-10, the dog-vs-cat classifier, the from-scratch Transformer for IMDB) don't touch bitwise ops at all. These nodes exist so the toolkit is complete, and the pack's author treats tensor ops as the raw material for the training graphs.
Two things will trip you up and both are the same thing: floats. torch.bitwise_or is integer/bool only, and a float tensor from an image pipeline will raise at runtime. Cast with PtToInt8/PtToInt32 first. Also keep shapes matched - broadcasting technically applies but a mismatched batch dimension is how you get an hour of "why is my graph broken." If you only want True/False merging of masks, use PtLogicalOr instead; bitwise OR on a bool tensor does the same thing, but logical is clearer about intent.
Installing it
Part of ComfyUI-Pt-Wrapper (Hide Inada / HowToSD). ComfyUI Manager → search "ComfyUI-Pt-Wrapper", or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper
Restart ComfyUI. Note the pack's dependency list is heavy - scikit-learn, transformers, datasets, gensim, scipy, peft and friends - so a Manager install that fails halfway usually means pip hit a snag on those. Fix it with pip install -r requirements.txt inside the clone. No model downloads required for the pure tensor nodes.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| tens_a | TENSOR | — | |
| tens_b | TENSOR | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| TENSOR | TENSOR | — |