Tensor Debug
Min, max, and mean for each channel
- latent
- LATENT
The Diffusion CG pack is all about latent-space color grading, and Tensor Debug is the tool that shows you why a recenter or normalization is doing what it does. It's a pass-through node that prints diagnostics to the ComfyUI console. The old README labels it "For development only," and that's the honest take - but for anyone fighting a color cast it's genuinely useful.
What it does
You drop it onto a LATENT wire, run the workflow, and it prints, for each of the 4 latent channels, the min, max, and mean values:
(min: -2.1345, max: 2.0011, mean: 0.0123)
Then it hands the latent along completely unchanged. No effect on the image, no extra VRAM cost worth mentioning.
Why you'd bother
A color cast shows up in latent statistics as channel means sitting away from the neutral point, or spread oddly relative to each other. Before you touch the recenter sliders, run Tensor Debug on a problematic generation and look at the numbers:
- Means clustered near 0 across all channels → your latent is already neutral; a grey wash is probably a VAE mismatch, not a sampling problem.
- Means clearly offset (say one channel sitting at 0.5 while the others hug zero) → that's the tint you want to recenter away, and the magnitude tells you how hard to push.
- One channel's max–min range dwarfing the others → that channel is dominating; a normalization pass is the lever.
If you're using the older sampler-style nodes from this pack (like Center Sampler), you can even iterate: check the mean, set that as your C/M/Y/K target, run again, confirm the mean lands where you asked. That's the workflow the author was clearly using while building the pack.
The inputs and outputs
One input, latent, one output, LATENT. The output is the same tensor that went in - this node is observation only.
A note on versions
This node comes from the early releases of the pack, when Diffusion CG lived as several separate nodes. The current v2 rewrite ships only Diffusion CG and Disable CG; Tensor Debug isn't in the latest release. If you want it specifically, install an older version of the pack - but for most people the modern workflow is simpler: run a generation, judge it, and adjust the two sliders on Diffusion CG. The debug node is a nice insight tool, not something you'd wire into a production workflow.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Haoming02/comfyui-diffusion-cg
Restart ComfyUI, search for "Tensor Debug". No dependencies, no models. And remember: the numbers it prints land in the terminal where you launched ComfyUI, not anywhere on the canvas - if you don't see output, look there.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |