lllyasviel/style2paints · error · RuntimeError
No input variables found for layer %s.
Error message
No input variables found for layer %s.
What it means
The @layer decorator wraps every network-building op; before invoking the op it reads self.terminals, the stack of current output variables of the Network. If terminals is empty there is no input to feed the new layer, so it raises immediately. This enforces that you always seed the graph (via feed or an input-producing op) before chaining layers.
Source
Thrown at V4/s2p_v4_server/smoother.py:15
import numpy as np
import scipy.stats as st
import tensorflow
tensorflow.compat.v1.disable_v2_behavior()
tf = tensorflow.compat.v1
def layer(op):
def layer_decorated(self, *args, **kwargs):
# Automatically set a name if not provided.
name = kwargs.setdefault('name', self.get_unique_name(op.__name__))
# Figure out the layer inputs.
if len(self.terminals) == 0:
raise RuntimeError('No input variables found for layer %s.' % name)
elif len(self.terminals) == 1:
layer_input = self.terminals[0]
else:
layer_input = list(self.terminals)
# Perform the operation and get the output.
layer_output = op(self, layer_input, *args, **kwargs)
# Add to layer LUT.
self.layers[name] = layer_output
# This output is now the input for the next layer.
self.feed(layer_output)
# Return self for chained calls.
return self
return layer_decorated
class Smoother(object):
def __init__(self, inputs, filter_size, sigma):View on GitHub (pinned to a0d164d6a8)
Solutions
- Call net.feed(input_tensor_or_layer_name) (or the setup/input op) before the first layer call
- Ensure the previous layer call actually succeeded — a swallowed exception can leave terminals empty
- If building multiple subgraphs, feed the correct starting layer before each new op chain
Example fix
# before net = Network() net.conv(3, 32, name='conv1') # RuntimeError # after net = Network() net.feed(image_placeholder, name='input') net.conv(3, 32, name='conv1')
Defensive patterns
Strategy: try-catch
Validate before calling
if len(net.terminals) == 0:
net.feed(input_tensor) # seed graph before layer calls Try / catch
try:
net.conv(3, 32, name='conv1')
except RuntimeError as e:
if 'No input variables found' in str(e):
net.feed(input_tensor)
net.conv(3, 32, name='conv1')
else:
raise Prevention
- Always call feed()/setup() immediately after constructing the Network
- Never interleave layer calls across Network instances
- Wrap multi-step build sequences so a failure mid-chain doesn't leave terminals empty unnoticed
When it happens
Trigger: Calling any decorated layer method (conv, max_pool, etc.) as the FIRST operation on a freshly constructed Network, before calling feed() or any op that sets terminals — e.g. `net = Network(); net.conv(...)` with no prior feed/input.
Common situations: Forgetting the initial feed() call after constructing the network; constructing a second Network object and reusing a layer-call sequence copied from code that had a feed; a branch where a conditional op never populated terminals.
Related errors
AI-assisted analysis of lllyasviel/style2paints@a0d164d6a8 (2026-09-02).
Data as JSON: /api/errors/933543ba2ef6e9bd.
Report an issue: GitHub.