ComfyUI Node
TEX Wrangle
TEX Wrangle: per-pixel tensor expressions for images, masks, and scalars. Reference inputs with @name (e.g. @A, @base_image). Write outputs with @name = expr (e.g. @OUT, @mask, @result). Add parameter widgets with $name (e.g. f$strength = 0.5). Supports float, int, vec2/vec3/vec4, mat3/mat4, string, and array types with if/else, for/while loops, and 100+ stdlib functions. Click the ? icon for a quick reference.
TEX Wrangle
- _tex_any
- in_0
- in_1
- in_2
- in_3
- in_4
- in_5
- in_6
- in_7
- in_8
- in_9
- in_10
- in_11
- in_12
- in_13
- in_14
- in_15
- out_0
- out_1
- out_2
- out_3
- out_4
- out_5
- out_6
- out_7
◄code// TEX Wrangle
// Read inputs with @A, @B, etc.
// Write output to @OUT
// Right-click → TEX Snippets for 116 examples
float gray = luma(@IN);
@OUT = vec3(gray);
►
◄deviceauto►
◄compile_modenone►
◄precisionfp32►
◄debug_nan_highlightfalse►
CategoryTEX
Inputs (22)
| Name | Type | Default | Description |
|---|---|---|---|
| code | STRING | // TEX Wrangle // Read inputs with @A, @B, etc. // Write output to @OUT // Right-click → TEX Snippets for 116 examples float gray = luma(@IN); @OUT = vec3(gray); | TEX source code. Use @name for inputs, @name = expr for outputs. Use $name for parameter widgets. |
| deviceopt | COMBO | auto | Execution device. auto: follows input tensors. cpu/cuda: force a specific device. |
| compile_modeopt | COMBO | none | none: standard interpreter (recommended default). auto: EXPERIMENTAL measured auto-tier — runs the fast codegen path and trials torch.compile in the background, committing only on a measured win. torch_compile: force JIT-compile via torch.compile. NOTE: auto/torch_compile need Triton for any GPU speedup — Triton is absent on most Windows installs, where they simply fall back to the interpreter on CUDA (CPU torch.compile works but is often slower for small programs). Run `tex doctor` to see whether Triton is present. cuda_graph: CUDA-graph replay (GPU only, needs NO Triton; big win for small launch-bound programs). All tiers fall back to the interpreter on failure. |
| precisionopt | COMBO | fp32 | fp32: full precision (default, recommended). auto: EXPERIMENTAL — runs fp16 ONLY where a condition-number gate proves it stays accurate (CUDA, >=1024x1024, smooth pointwise, no amplification/ill-conditioning; verified across 225 adversarial programs); everything else runs fp32. A per-cook finiteness net makes auto ~perf-NEUTRAL — it's an accuracy-safe convenience, not a speedup. fp16: EXPERT — force half-precision IMAGE temps for the raw ~1.35-1.45x win with NO safety net (coordinates & sampling stay fp32; ~1e-3 accuracy, diverges on threshold/branch/amplifying programs). LATENT stays fp32. |
| debug_nan_highlightopt | BOOLEAN | false | DBG-3: paint any pixel that is NaN or Inf bright magenta so non-finite output is visible at a glance (a 0/0, a log of a negative, an fp16 overflow). Off by default and zero-cost when off. Sits above all tiers, so it works on every execution path. |
| _tex_anyopt | * | TEX accepts any input type. Use @name in code to reference it. | |
| in_0opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_1opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_2opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_3opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_4opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_5opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_6opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_7opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_8opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_9opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_10opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_11opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_12opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_13opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_14opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. | |
| in_15opt | * | Internal lazy input slot — mapped from wired user inputs at queue time. |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| out_0 | * | TEX output. Type auto-inferred from code. |
| out_1 | * | TEX output. Type auto-inferred from code. |
| out_2 | * | TEX output. Type auto-inferred from code. |
| out_3 | * | TEX output. Type auto-inferred from code. |
| out_4 | * | TEX output. Type auto-inferred from code. |
| out_5 | * | TEX output. Type auto-inferred from code. |
| out_6 | * | TEX output. Type auto-inferred from code. |
| out_7 | * | TEX output. Type auto-inferred from code. |