Add edge count consistency check to graph creation tests#301
Add edge count consistency check to graph creation tests#301osten-antonio wants to merge 8 commits into
Conversation
|
This test looks good to me. Have you tested it manually (hacking the test so that it would fail), so that the error message looks good? Could you also add a changelog entry for this? |
@joeloskarsson Yep, I have and it works |
joeloskarsson
left a comment
There was a problem hiding this comment.
Sorry for taking so long to look at this again😅 The tag got lost with so many other notifications.
I guess there is a question here if we need to work on the testing for graph creation in neural-lam, as the main effort atm is to move this to using weather-model-graphs (e.g. #323 #596 ). If you are still interested in work on this, and resolving the current conflicts, I would not mind merging this in, but let me know if this still feels like time well spent with this in mind.
No worries! Yes, I'm still interested to work on this, and will be resolving the conflicts. I have checked weather-model-graphs, and it does use the same file contract iwth *_features and *_edge_index (from save.py), so I think this test should still be relevant. |
|
@joeloskarsson I have resolved all of the conflicts, and also retested, works as expected. |
joeloskarsson
left a comment
There was a problem hiding this comment.
While WMG still uses the same graph format, unless I misunderstand this test is specifically testing the graphs created using create_graph.py, thereby my confusion. But nonetheless, I see no problem with this contribution, and it does improve a test that is in the codebase.
|
Linting seems required though to make CI green |



Describe your changes
Implements the TODO in
test_graph_creationthat noted edge count consistency between paired graph files was not being checked.Each edge set in the generated graph consists of two files:
*_edge_index.pt— shape[2, E], connectivity between nodes*_features.pt— shape[E, 3], attributes for each edgeThe previous test validated each file's feature dimension independently but never verified that both files described the same number of edges
E. A mismatch would pass all existing assertions silently, but cause wrong message passing or an index-out-of-bounds error at training time.Changes:
edge_index_feature_pairslist declaring which index/feature files must match (includingmesh_up/mesh_downfor hierarchical graphs)# TODOcomment as it is now implementedNo new dependencies required.
Type of change
(This is a test improvement - none of the above categories apply exactly)
Checklist before requesting a review
pullwith--rebaseoption if possible).Checklist for reviewers
Each PR comes with its own improvements and flaws. The reviewer should check the following:
Author checklist after completed review
reflecting type of change (add section where missing):
Checklist for assignee