ComfyUI Node

NNT Show Layer Stack

Read back the architecture you just drew before you compile it

By inventorado·Created 2 years ago·Updated 2 years ago· 69
NNT Show Layer Stack
  • LAYER_STACK
  • l
show_detailsBasic

You've chained ten layer nodes together and you can no longer remember whether you set stride 2 on the conv or the pooling layer. NNT Show Layer Stack is the sanity-check node for exactly that moment: you feed it the LAYER_STACK that your layer chain produces, and it prints a readable report of every layer in the stack. It's the "show me what I actually built" node, and in a pack whose whole point is teaching by doing, it's quietly one of the most useful.

In the Neural Network Toolkit, layers aren't nn.Module objects yet - they're dictionaries describing a layer, passed down a chain until NntCompileModel turns the whole LIST into a real PyTorch model. LAYER_STACK is that list of dicts. This node just reads it and formats it.

What it shows

One input that matters: LAYER_STACK (the list of layer dicts), plus a show_details toggle with two settings:

  • Basic - one line per layer: type, plus the headline parameters (nodes/activation for dense layers, out channels/kernel/stride/padding for conv layers, and so on).
  • Detailed - everything. Weight initialization and its gain/mode/nonlinearity, bias settings, normalization epsilon and momentum, dropout rate, dilation, groups, output padding - all the fields the layer nodes let you set but you forgot you set.

You get a single STRING output. Wire it into a text display node (the pack's example workflows use ComfyUI-Jjk-Nodes for that, which Manager will offer to install) or any Show Text–style node you already have.

Why you want it

Two workflows make this node worth installing. First, debugging before compile: if you wire a layer stack straight into NntCompileModel and the compile fails - a shape mismatch, a bad kernel, a layer that got dropped - you're staring at a black box. This node shows you the recipe in plain text so you can find the offending layer. Second, learning: if you're following along with a tutorial or the pack's example workflows (MNIST CNN, CIFAR10 conv net), dumping the stack and reading "Layer 3: Type=Conv2d, Out Channels=32, Kernel=3, Stride=1, Padding=1" makes the architecture legible in a way a blob of wires never is.

Install

It's part of the pack, so:

cd ComfyUI/custom_nodes
git clone https://github.com/inventorado/ComfyUI_NNT.git
cd ComfyUI_NNT
pip install -r requirements.txt

Then restart ComfyUI. Manager works too - search "ComfyUI Neural Network Toolkit NNT". The dependency list is heavy (torch, numpy, pandas, matplotlib, sklearn, transformers, onnx, statsmodels, shap 0.41.0, and friends), so expect a slow first install; that's the price of the whole toolkit.

One honest limitation: this node reports what the layer dicts say, not what the compiled nn.Module will actually do with them. It won't catch a layer combination that compiles but produces nonsense shapes. For that you want NntShowModelInfo on the compiled model side. But for "did I connect the layers I thought I did," this is the fastest answer in the pack.

CategoryNNT Neural Network Toolkit/Layers

Inputs (2)

NameTypeDefaultDescription
LAYER_STACKLIST
show_detailsCOMBOBasic2 options: Basic, Detailed

Outputs (1)

NameTypeDescription
lSTRING