NNT Define GRU Layer
NNT Define GRU Layer — the cheaper cousin of the LSTM, in node form
- LAYER_STACK
- LAYER_STACK
The GRU is the LSTM's lighter sibling: same job - remembering things across a sequence - with fewer gates and less compute. For a lot of sequence tasks it gets you 95% of the LSTM's capability at a smaller footprint, which is why it's worth having in the toolkit even though it looks almost identical to its sibling node. NntDefineGRULayer appends a GRU definition to your LAYER_STACK.
The inputs
Identical field-for-field to the LSTM node, because a GRU constructor is basically an LSTM constructor with the forget-gate drama removed:
- input_size (default 10) - features per time step.
- hidden_size (default 20) - hidden state width.
- num_layers (default 1) - stacked GRUs.
- bias (True), batch_first (True), dropout (0), bidirectional (False).
Output: LAYER_STACK. The node records {'type': 'GRU', ...} and passes the growing list along.
How it works - same story as LSTM, so read it once
The pattern for the recurrent nodes in this pack is uniform: the define node writes a config dict onto the stack list, and NntCompileModel is supposed to turn that into nn.GRU at build time. The honest caveat from the source (v1.0.3): the compile loop currently materializes the classic layer types - Conv, Linear, Flatten, Reshape, pooling, norms - and GRU isn't in that dispatch list yet. The nn.GRU class appears nowhere in the compile path. So this node is currently a declaration: it builds the stack entry, but the model-building step that should instantiate it hasn't landed.
That's not a bug report against you - it's just where the pack is. It's an educational hobby project and the author says so. If your compiled model doesn't contain the GRU, that's expected behavior today, not a workflow mistake. Treat it as a node to learn the stack format with, and reach for plain PyTorch if you need a trainable GRU now.
Common issues
- GRU missing from the compiled model - expected; see above.
- Choosing GRU vs LSTM - if and when these compile, GRU wins on speed and memory, LSTM is the classic default. For teaching purposes the difference is the lesson.
Install
Pack-level, nothing special:
cd ComfyUI/custom_nodes
git clone https://github.com/inventorado/ComfyUI_NNT.git
cd ComfyUI_NNT
pip install -r requirements.txt
or ComfyUI Manager → "ComfyUI Neural Network Toolkit NNT", then restart ComfyUI. It sits with the other recurrent nodes under NNT Neural Network Toolkit/Layers.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| input_size | INT | 101–2048 | — |
| hidden_size | INT | 201–2048 | — |
| num_layers | INT | 11–10 | — |
| bias | COMBO | True | 2 options: True, False |
| batch_first | COMBO | True | 2 options: True, False |
| dropout | FLOAT | 0.00–1 | — |
| bidirectional | COMBO | False | 2 options: True, False |
| LAYER_STACKopt | LIST | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LAYER_STACK | LIST | — |