diff --git a/CHANGELOG.md b/CHANGELOG.md index 7611c27fe..ed815099e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the packages adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Entries link to the pull request that introduced them. +## GNNLux.jl 0.3.1-DEV + +**Fixed** +- `MEGNetConv` now returns the updated state from its edge and node update layers, so stateful sublayers retain their state across calls ([#734]). + ## GNNGraphs.jl 1.6.0 - 2026-11-04 **Added** @@ -251,4 +256,5 @@ Lux implementations of the graph convolutional, pooling, and temporal layers [#722]: https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/pull/722 [#718]: https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/pull/718 [#728]: https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/pull/728 +[#734]: https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/pull/734 [FluxML/Zygote.jl#1662]: https://github.com/FluxML/Zygote.jl/issues/1662 diff --git a/GNNLux/Project.toml b/GNNLux/Project.toml index 5008cc7c9..06eed6dfd 100644 --- a/GNNLux/Project.toml +++ b/GNNLux/Project.toml @@ -1,6 +1,6 @@ name = "GNNLux" uuid = "e8545f4d-a905-48ac-a8c4-ca114b98986d" -version = "0.3.0" +version = "0.3.1-DEV" authors = ["Carlo Lucibello and contributors"] [workspace] diff --git a/GNNLux/src/layers/conv.jl b/GNNLux/src/layers/conv.jl index 236b9dfc6..f7b8ee925 100644 --- a/GNNLux/src/layers/conv.jl +++ b/GNNLux/src/layers/conv.jl @@ -1541,9 +1541,11 @@ end function (l::MEGNetConv)(g, x, e, ps, st) ϕe = StatefulLuxLayer{true}(l.ϕe, ps.ϕe, _getstate(st, :ϕe)) - ϕv = StatefulLuxLayer{true}(l.ϕv, ps.ϕv, _getstate(st, :ϕv)) + ϕv = StatefulLuxLayer{true}(l.ϕv, ps.ϕv, _getstate(st, :ϕv)) m = (; ϕe, ϕv, aggr=l.aggr) - return GNNlib.megnet_conv(m, g, x, e), st + y = GNNlib.megnet_conv(m, g, x, e) + stnew = (; ϕe = _getstate(ϕe), ϕv = _getstate(ϕv)) + return y, stnew end diff --git a/GNNLux/test/layers/conv.jl b/GNNLux/test/layers/conv.jl index e9a93cfb6..4e997ecb1 100644 --- a/GNNLux/test/layers/conv.jl +++ b/GNNLux/test/layers/conv.jl @@ -107,6 +107,17 @@ @test size(x_new) == (out_dims, g.num_nodes) @test size(e_new) == (out_dims, g.num_edges) + + ϕe = Chain(Dense(3in_dims => out_dims), BatchNorm(out_dims)) + ϕv = Chain(Dense(in_dims + out_dims => out_dims), Dense(out_dims => out_dims)) + l = MEGNetConv(in_dims, out_dims, ϕe, ϕv) + ps, st = LuxCore.setup(rng, l) + _, st_new = l(g, x, e, ps, st) + + @test typeof(st_new) == typeof(st) + @test st_new.ϕe.layer_2.running_mean != st.ϕe.layer_2.running_mean + _, st_newer = l(g, x, e, ps, st_new) + @test typeof(st_newer) == typeof(st) end @testset "NNConv" begin