ComfyUI Node

Pt Ge

Is tensor A at least tensor B, everywhere at once

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

Pt Ge is the "greater than or equal to" comparison node in the HowToSD/ComfyUI-Pt-Wrapper pack - a thin wrapper around torch.ge. Give it two tensors and it returns a third tensor of the same shape whose elements are True where tens_a >= tens_b and False where not. The "Ge" name is the PyTorch abbreviation, which is why the search on this one is a bit awkward; the display name is "Pt Ge". It's the ≥ member of a small family that also includes Pt Gt (>), Pt Ne (≠), Pt Eq, Pt Le, Pt Lt, and friends.

When you'd actually reach for it

Comparison ops rarely sit alone in a workflow. The pattern is: threshold something, then branch. You might compare a tensor of scores against a constant tensor (build one with Pt Full) to produce a boolean mask, then feed that mask into Pt Where, Pt Masked Select, or a logical operator like Pt Logical And to pick which samples survive. If you're training a classifier in this pack and you want to inspect which predictions cleared a confidence bar, this is the node that builds the mask. It's also handy mid-debugging - compare a tensor against an expected value and print the boolean result with Pt Show Text to see if your pipeline is producing sane numbers.

How it works

Straightforward element-wise comparison, done on the GPU alongside whatever else is in the graph. tens_a and tens_b need to be broadcast-compatible - same shape, or shapes that PyTorch can broadcast together. The output is a boolean tensor, so subsequent math on it will treat True as 1 and False as 0, which is often exactly what you want for counting.

The inputs

Just two:

  • tens_a - the left-hand side of the comparison.
  • tens_b - the right-hand side.

Both are TENSOR type, and the single output is a TENSOR of booleans. Nothing else to set; this node is about as minimal as the pack gets.

Installing the pack

Pt Ge is part of the Pt-Wrapper pack's "Data Analysis" category, which covers the tensor-math nodes (the Ptn-* model and training nodes live under "Training"). Install via ComfyUI Manager by searching "ComfyUI-Pt-Wrapper", or:

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

Restart ComfyUI afterward. The full pack pulls in heavy pip dependencies (transformers, datasets, peft, scikit-learn, gensim…), so give the first install time; no model files are required just to run comparison nodes.

Common issues

  • Shape mismatch - the most common failure. Two tensors that can't broadcast throw a torch runtime error; double-check shapes with Pt Show Size before wiring.
  • Boolean output surprises - remember the result is bool. If you multiply it by a float tensor expecting a scaled mask, PyTorch will usually promote, but if you feed it somewhere expecting floats directly, you'll get a dtype error. Cast with Pt To Float32 when in doubt.
  • Zero community signal - like the rest of this pack, Pt Ge is a single-author educational tool with essentially no footprint on r/comfyui. If you're stuck, the author's node reference docs and example workflows are the support network; don't expect a Reddit thread to exist.
CategoryData Analysis

Inputs (2)

NameTypeDefaultDescription
tens_aTENSOR
tens_bTENSOR

Outputs (1)

NameTypeDescription
TENSORTENSOR