Repository navigation
Split components/layers.py into focused modules - #922
Merged
sevmag merged 18 commits intoSep 11, 2026
Merged
Conversation
Makes the module's public API explicit for star imports and linters. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Start a dedicated module for the EdgeConv family of graph convolution layers; components.layers re-exports the name so existing imports and saved model configs keep working. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
The EdgeConv family (DynEdgeConv, EdgeConvTito, DynTrans) is now complete in its own module. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Start a dedicated module for the dense transformer building blocks; components.layers re-exports the name so existing imports and saved model configs keep working. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
The dense transformer blocks (DropPath, Mlp, Attention_rel, Block_rel, Block) are now complete in their own module. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Start a dedicated module for the GRIT graph-transformer layers; the name avoids clashing with the GritTransformer model in models/gnn/grit. components.layers re-exports the name so existing imports and saved model configs keep working. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
layers.py now only re-exports; all layer implementations live in dedicated modules. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
All layer classes are importable only from their dedicated modules (edge_convolutions, attention_blocks, grit_layers). Saved model configs that reference graphnet.models.components.layers by full path must be re-saved against the new locations. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
The module imports cleanly so that pkgutil-based module scans (the ModelConfig class-namespace build imports every graphnet submodule) keep working, but any attribute access — including `from ...layers import X` and full-path `!class` references in saved configs — raises with a pointer to the class's new module. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9
sevmag
force-pushed
the
refactor/split-components-layers
branch
from
September 10, 2026 20:39
1f9a58a to
df16393
Compare
Aske-Rosted
approved these changes
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
components/layers.pyhad grown to ~1000 lines holding three unrelated families of layers. This PR splits it into focused modules, one class per commit, with no behavioral changes — every class body is moved verbatim — and removeslayers.pyat the end:components/edge_convolutions.py— the EdgeConv family:DynEdgeConv,EdgeConvTito,DynTranscomponents/attention_blocks.py— dense transformer blocks:DropPath,Mlp,Attention_rel,Block_rel,Blockcomponents/grit_layers.py— the GRIT graph-transformer family:GritSparseMHA,GritTransformerLayer,SANGraphHead(namedgrit_layersto avoid clashing with theGritTransformermodel inmodels/gnn/grit.py)All in-repo consumers (
dynedge,dynedge_jinst,dynedge_kaggle_tito,particlenet,icemix,grit) import from the new locations.graphnet.models.components.layersno longer exists. External code importing from it must switch to the dedicated modules. SavedModelConfigYAMLs are unaffected when they reference classes by bare name, but configs embedding the full path (!class graphnet.models.components.layers <Name>entries) must be re-saved against the new locations.Structure
Each commit moves exactly one class (or updates one consumer group) and leaves the tree green — the full pre-commit suite (black, flake8, docformatter, pydocstyle, mypy) passes on every commit, so the branch stays bisectable. The intermediate commits route consumers through re-exports in
layers.py; the final commit deletes it.🤖 Generated with Claude Code
https://claude.ai/code/session_013B53eM2fgkivj8xxVnhjQ9