Nodes/ComfyDL/Show Heatmaps (Output)
ComfyUI Node

Show Heatmaps (Output)

Attention, rendered right in the graph

By Cynthia-lxx·Created 2 months ago·Updated 3 days ago· 6
Show Heatmaps (Output)
  • matrices
    xlabel
    ylabel
    figsize_w2.5
    figsize_h2.5
    cmapReds
    titles
    max_samples262144
    dimsauto
    axis_reducemean
    auto_selectlast_n
    auto_n0
    on_errorfallback_first_n

    Some things you want to pipe into other nodes, and some things you just want to see. CdlShowHeatmaps (Output) is the see-it version - the output-node variant of ComfyDL's heatmap visualizer that renders your matrix tensors directly in the ComfyUI interface, with a colorbar, no Preview node required. It's the same engine as Show Heatmaps minus the IMAGE output; the figure goes to your screen instead of a socket.

    ComfyDL borrows the "dual variant" design from the d2l toolbox it ports: every visualization has an (Output) twin for when the goal is eyeballing, and a plain twin for when the chart is data. This one is the eyeballing twin for heatmaps - and if you're doing anything with attention weights or weight matrices in this pack, it's the node that makes them legible.

    The inputs

    • matrices - a cdlTensor, auto-promoted to 4-D like its sibling:
      • 2-D [H, W] → one heatmap
      • 3-D [N, H, W] → a row of N
      • 4-D [N, M, H, W] → an N×M grid
    • xlabel, ylabel - axis labels.
    • figsize_w / figsize_h - per-cell size (default 2.5 each); the whole figure scales as w*cols × h*rows.
    • cmap - matplotlib colormap, default "Reds".
    • titles - comma-separated subplot titles (optional).

    It's an output node, so there are no outputs - the render is the result.

    Installing ComfyDL

    The pack's standard light install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Cynthia-lxx/ComfyDL
    cd ComfyDL && pip install -r requirements.txt
    

    Restart ComfyUI; it's under ComfyDL → Visualization with its display name "Show Heatmaps (Output)". Or search "ComfyDL" in ComfyUI Manager. Only dependency is matplotlib.

    The important differences from the plain version

    Because it's an output node, ComfyUI treats it as a terminal: it always runs, and its result shows inline. That's genuinely useful for debugging attention during a run - but it also means it sits at the end of the chain. If you want the same heatmap and to keep using the image downstream, you'd wire the plain Show Heatmaps into a Preview instead; the two variants are mutually exclusive in purpose, not interchangeable.

    A practical note: output nodes that always run can keep their upstream alive in ways you might not expect while you're rearranging a graph. If you're surprised that a whole branch keeps executing when you thought you'd bypassed it, check whether an (Output) node is anchoring it - that's the caching behavior, not a bug.

    The shape trap

    Same one as the sibling: 4-D is read as [N, M, H, W] - rows, then columns. If you feed a transposed or differently-ordered tensor, the grid renders beautifully and completely wrong. And the auto-promotion is additive (a 2-D becomes [1, 1, H, W]), so extra pre-added dims aren't ignored. When in doubt, check the input's actual shape with the pack's tensor-inspection node before rendering.

    Categoryd2l/Visualization

    Inputs (13)

    NameTypeDefaultDescription
    matricesTENSOR
    xlabelSTRING
    ylabelSTRING
    figsize_wFLOAT2.50.5–20
    figsize_hFLOAT2.50.5–20
    cmapSTRINGReds
    titlesoptSTRING
    max_samplesoptINT2621440–1073741824
    dimsoptSTRINGauto
    axis_reduceoptCOMBOmean4 options: mean, max, first, mid
    auto_selectoptCOMBOlast_n4 options: first_n, last_n, most_informative_n, least_informative_n
    auto_noptINT00–3
    on_erroroptCOMBOfallback_first_n2 options: error, fallback_first_n

    Outputs (0)

    No outputs