You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GNNLux NNConv returns its state without the nn wrapper, so the state can't be fed back in #727
In GNNLux, NNConv returns the inner network's state directly instead of wrapping it as (; nn = ...). Its input state is (; nn = ...) (from initialstates, and the forward pass reads st.nn), so the returned state has a different structure than the one it expects. Feeding it back into the layer then fails, which is what a training loop does on its second step.
Minimal example:
using GNNLux, Lux, Random
rng = Random.Xoshiro(0)
g =GNNGraph([1, 1, 2, 3], [2, 3, 1, 1])
x =randn(rng, Float32, 3, g.num_nodes)
e =randn(rng, Float32, 10, g.num_edges)
l =NNConv(3=>5, Dense(10=>15), tanh)
ps, st = Lux.setup(rng, l) # st == (nn = NamedTuple(),)
y, st2 =l(g, x, e, ps, st) # st2 == NamedTuple() <- `nn` wrapper is gonel(g, x, e, ps, st2)
# ERROR: FieldError: type NamedTuple has no field `nn`; NamedTuple has no fields at all.
With a stateful inner network, e.g. Chain(Dense(10 => 15), BatchNorm(15)), the returned state is (layer_1 = ..., layer_2 = ...) and the second call fails the same way (type NamedTuple has no field nn, available fields: layer_1, layer_2).
The same thing happens with Lux.Training.single_train_step!: the first step works, the second one throws the FieldError, so an NNConv model can't be trained with the standard Lux training loop.
Expected: the returned state has the same structure as the input, (; nn = <updated nn state>), like EdgeConv and GINConv already do.
This is the same kind of problem that #715 fixed for GNNChain. The current tests don't catch it because test_lux_layer never passes the returned state back in.
Versions: Julia 1.13.3, GNNLux 0.3.0-DEV (master at aa2926c), Lux 1.31.5.
Activity
parth-patel010 commentedon Nov 4, 2026
I'd like to work on this, will open a PR shortly.