Nodes/comfyui-spawner-nodes/张量信息探针
ComfyUI Node

张量信息探针

A quick shape, dtype, device, and stats readout for any tensor

By spawner1145·Created about a year ago·Updated 11 months ago· 2
张量信息探针
  • tensor
  • shape
  • dtype
  • device
  • min_value
  • max_value
  • mean_value

You know the drill: you're wiring up a workflow, something downstream is throwing a dimension error, and you have no idea what shape the tensor on that wire actually is. TensorInspector is the "print it" node for this pack's tensor world - feed it any TENSOR and it hands back six facts in one shot.

The six outputs are self-explanatory and that's the point:

  • shape - the shape as a list, e.g. [1, 77, 768].
  • dtype - torch.float32 and friends.
  • device - cuda:0, cpu, wherever it lives. The classic "my tensor is on the wrong device" check.
  • min_value, max_value, mean_value - three FLOAT outputs with the actual statistics, so you can see at a glance whether a tensor is dead (all zeros) or exploded (mean in the thousands).

The mechanism is worth knowing because it explains one edge case: for big tensors it samples down to at most one million elements before computing min/max/mean, so the stats are approximate for huge embeddings, not exact. That's a deliberate speed trade - a 4-billion-element tensor doesn't need a full pass to tell you it's alive. For empty tensors it returns zeros instead of crashing, which is friendlier than most debug nodes. If the input isn't a tensor at all, it returns "None" strings and zeros rather than blowing up.

Where this fits: it's the raw-material cousin of ConditioningInspector. That node inspects CONDITIONING wires (tensors plus their metadata); this one inspects the bare TENSOR type this pack threads between its nodes. If you're debugging TensorConcatenation or TensorPooledMerge output, drop an Inspector on the wire and you'll spot the shape mismatch instantly.

Two honest gotchas. First, the TENSOR input is pack-internal - you can't inspect a LATENT or IMAGE with this; you'd have to convert first (and this pack doesn't ship a converter, so realistically you inspect the pack's own tensors). Second, mean_value on a mix of positives and negatives can look like zero while the tensor is perfectly healthy - normalization artifacts. Check min and max too, not just the mean.

Install

Via ComfyUI Manager (search comfyui-spawner-nodes), or:

cd ComfyUI/custom_nodes
git clone https://github.com/spawner1145/comfyui-spawner-nodes

Restart, and the pack's light deps (piexif, pypng, xmltodict) install automatically. No models, no heavy requirements. The README is basically empty ("some toolkits"), the on-node labels are Chinese, and the author - spawner1145, a Chinese-speaking dev also known for a Wan2.1 extension for SD WebUI - clearly built this for personal use and released it. It works; it's just barely documented.

Troubleshooting

  • All outputs show zeros - either the tensor is genuinely all-zero, or it was empty. The node returns zeros for both; Inspector can't tell you which, so check upstream.
  • Stats look off for a huge tensor - expected. The 1M-sample cap makes them approximate by design.
  • Can't wire your IMAGE/LATENT in - this node only takes the pack's TENSOR type. Use ConditioningInspector for conditioning, or a core debug/display node for images and latents.
Categoryspawner/tensor

Inputs (1)

NameTypeDefaultDescription
tensorTENSOR

Outputs (6)

NameTypeDescription
shapeSTRING
dtypeSTRING
deviceSTRING
min_valueFLOAT
max_valueFLOAT
mean_valueFLOAT