ComfyUI Node

NNT Input Layer

Every NNT model starts here (and it's the one node you can't skip)

By inventorado·Created 2 years ago·Updated 2 years ago· 69
NNT Input Layer
    • LAYER_STACK
    input_shape_str[3, 224, 224]

    In the Neural Network Toolkit, every model is a chain that starts with one node: NNT Input Layer. It's the boring part of your graph, and it's also the part everything else is built on. It declares the shape of the data your network expects, and without it NntCompileModel will flat-out refuse to compile - the compile step looks for an Input entry in the layer stack and errors if there isn't one.

    What it actually does

    The node takes a single text field, input_shape_str, parses it into a list of integers, and packages it as the first entry of a LAYER_STACK - the LIST that flows through every layer node in this pack and finally into NntCompileModel. Wire its output into the LAYER_STACK input of your first real layer (a dense, conv, or pool node), keep chaining, and the whole architecture is just a list of layer descriptions by the time it hits the compiler.

    The shape is channels-first and excludes the batch dimension, matching PyTorch's convention. So [3, 224, 224] (the default) means a 3-channel, 224×224 image - exactly what a Conv2d expects to see on its channel axis. MNIST's 28×28 grayscale would be [1, 28, 28].

    Inputs that matter

    Only one, and it's dead simple:

    • input_shape_str - a Python-style list of ints, e.g. [3, 224, 224] or [10] for a plain 10-feature vector. If you want a batch dimension, don't add it here; the toolkit prepends one for you.

    Quirks worth knowing

    Two things catch people. First, the shape is parsed with a (sandboxed) eval, so it must be a literal list of ints - [3, 224, 224] yes, 3, 224 no, [3, "a", 224] no. Second, this node starts the stack rather than appending to it: unlike every other define node, it has no LAYER_STACK input, and its output is always a fresh one-entry list. Feed a second Input Layer into the graph and it resets the architecture instead of extending it - which is occasionally useful for swapping dataset shapes, more often just a source of "why is my model only one layer?" confusion.

    Installing NNT

    The pack is inventorado/ComfyUI_NNT, installable via ComfyUI Manager (search "ComfyUI Neural Network Toolkit") or:

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

    Heads up: that requirements.txt is a full data-science stack (torch, pandas, scikit-learn, transformers, shap, seaborn, onnx…), so the first install can take a while and occasionally fights an existing environment - the standard ComfyUI dependency-hell we all know. Restart ComfyUI after installing, and if you load one of the pack's example workflows, let Manager fetch ComfyUI-Jjk-Nodes for the text display nodes.

    NNT is a genuinely fun teaching tool - the author built it while learning neural nets himself and it shows in how visual everything is. Just remember the README's own warning: it's a work in progress and not a production training stack.

    CategoryNNT Neural Network Toolkit/Layers

    Inputs (1)

    NameTypeDefaultDescription
    input_shape_strSTRING[3, 224, 224]

    Outputs (1)

    NameTypeDescription
    LAYER_STACKLIST