ComfyUI Node

Pt Lt

The strict less-than comparison

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

Pt Lt is the strict version of the comparison family: torch.lt, element-wise, True where the first tensor is strictly less than the second. If Pt Le is the "under or at the threshold" node, this is "under the threshold, period." It's the node you reach for when equality at the cutoff shouldn't count as a pass.

How it works

Two required TENSOR inputs - tens_a and tens_b - and one boolean TENSOR output. The implementation is a one-liner, torch.lt(tens_a, tens_b), with torch's normal broadcasting. Both inputs are the pack's TENSOR type, and there are no settings to fiddle with. Scalar-vs-tensor comparisons work fine, which is how you threshold an entire tensor against a single cutoff value.

Why the "strict" bit matters

The difference between Pt Lt and Pt Le is one boundary value, and in real workflows that boundary can matter a lot. A loss threshold, a score cutoff, a tolerance check - whether an exactly-equal value squeaks through or not changes your results. When you're building a filter chain (comparison → logical combine → Pt Masked Select), picking strict versus non-strict is a deliberate choice, and it's nice to have both spelled out as separate nodes instead of hidden in a checkbox.

Same downstream pattern as Pt Le: the boolean output feeds straight into Pt Logical And/Or/Xor, or into Pt Masked Select to grab the passing elements. Comparisons are how the pack turns continuous values into decisions, and Lt is half of the two-threshold toolkit (the other half being Pt Gt, its sibling elsewhere in the pack).

Gotchas

The output is bool-typed - cast it before wiring into float math. And remember it's strict: tens_a == tens_b yields False here. If you want equality included, that's Pt Le's job.

Installing

Pt Lt ships in the HowToSD/ComfyUI-Pt-Wrapper pack under the "Data Analysis" menu - install the pack, get ~200 nodes. ComfyUI Manager: search ComfyUI-Pt-Wrapper, install, restart. Manual:

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

The pack's requirements are heavy (transformers, datasets, peft, accelerate…) for the training side; comparison ops need only PyTorch, which ComfyUI already has. Skip the pip line for math-only use. No models to download.

And the standing pack rule: its TENSOR type is not ComfyUI's IMAGE/LATENT - convert images in with Pt From Image (Pt From Image Transpose for (b, c, h, w)), back out with Pt To Image, or the wires won't connect.

CategoryData Analysis

Inputs (2)

NameTypeDefaultDescription
tens_aTENSOR
tens_bTENSOR

Outputs (1)

NameTypeDescription
TENSORTENSOR