Skip to content

Learnable epsilon in GIN - #697

Merged
CarloLucibello merged 7 commits into
JuliaGraphs:masterfrom
aurorarossi:learnable-epsilon-gin
Nov 29, 2026
Merged

CarloLucibello merged 7 commits into
JuliaGraphs:masterfrom
aurorarossi:learnable-epsilon-gin

Conversation

@aurorarossi

Copy link
Copy Markdown
Member

This PR adds PyTorch Geometric-style ϵ and train_eps options to GINConv for both Flux and Lux.

GINConv(nn; train_eps = true)  # trainable eps, initialized to 0
GINConv(nn;  ϵ  = 0.1f0)       # fixed eps

@CarloLucibello

Copy link
Copy Markdown
Member

needs a rebase

Comment thread GNNlib/src/layers/conv.jl Resolved
Comment thread GNNLux/src/layers/conv.jl Resolved
Comment thread GraphNeuralNetworks/src/layers/conv.jl Resolved
@aurorarossi
aurorarossi force-pushed the learnable-epsilon-gin branch 2 times, most recently from f0c8676 to 1d99de0 Compare September 30, 2026 13:09
aurorarossi and others added 7 commits November 29, 2026 09:09
- GNNLux: keep ϵ a scalar in the layer and create a fresh `Float32[ϵ]`
  in `initialparameters`, so parameters don't alias the layer struct.
- Document both positional and keyword ϵ; define `x` in the Flux example.
- Test trainable-ϵ gradients against finite differences, and the
  forward pass against (1 + ϵ) xᵢ + ∑ⱼ xⱼ in both frontends.
- Bump GraphNeuralNetworks to 1.2.0-DEV; require GNNlib 1.5 in the
  frontends (array ϵ in `gin_conv`).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@CarloLucibello
CarloLucibello merged commit 56fd000 into JuliaGraphs:master Nov 29, 2026
10 of 12 checks passed
CarloLucibello added a commit to i-Amogh/GraphNeuralNetworks.jl that referenced this pull request Nov 29, 2026
The Flux NNConv falls back to `edge_features(::GNNHeteroGraph)`, new in
GNNGraphs 1.7. (The GraphNeuralNetworks 1.2.0-DEV bump and the GNNlib 1.5
compat in both frontends already came with JuliaGraphs#697.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CarloLucibello added a commit to i-Amogh/GraphNeuralNetworks.jl that referenced this pull request Nov 29, 2026
The Flux NNConv falls back to `edge_features(::GNNHeteroGraph)`, new in
GNNGraphs 1.7. (The GraphNeuralNetworks 1.2.0-DEV bump and the GNNlib 1.5
compat in both frontends already came with JuliaGraphs#697.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CarloLucibello added a commit to i-Amogh/GraphNeuralNetworks.jl that referenced this pull request Nov 29, 2026
The Flux NNConv falls back to `edge_features(::GNNHeteroGraph)`, new in
GNNGraphs 1.7. (The GraphNeuralNetworks 1.2.0-DEV bump and the GNNlib 1.5
compat in both frontends already came with JuliaGraphs#697.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CarloLucibello added a commit that referenced this pull request Nov 29, 2026
* Adding NNConv support for HeteroGraphConv

* Refactoring

* Aligning with changes in GMMConv

* Make edge_features(::GNNHeteroGraph) throw on ambiguous input and test it

`@error` only logs and returns `nothing`; throw an `ArgumentError` instead
when the graph has several edge types or several edge feature arrays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* NNConv: clear error without edge features, document bipartite input, test values

- `(l::NNConv)(g, x, e = edge_features(g))` throws an `ArgumentError` when
  no edge features are given nor stored in `g`.
- Document the `(xj, xi)` tuple input and the default `e` in the NNConv
  docstring, and how HeteroGraphConv layers get their edge features.
- Check the hetero NNConv output and its Zygote gradients against the
  homogeneous NNConv on graphs whose nodes are the union of src and dst
  nodes (also in GNNLux, for the tuple input), instead of only sizes.
- Revert a stray whitespace change in the GCNConv hetero test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Require GNNGraphs 1.7, mark NNConv as heterograph-capable in docs

The Flux NNConv falls back to `edge_features(::GNNHeteroGraph)`, new in
GNNGraphs 1.7. (The GraphNeuralNetworks 1.2.0-DEV bump and the GNNlib 1.5
compat in both frontends already came with #697.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Amogh <defalt@Amoghs-MacBook-Air.local>
Co-authored-by: CarloLucibello <carlo.lucibello@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants