Fix: edge_feat_embedding crashes on empty edge_index when normalized_features=True*#50
Open
atharrva01 wants to merge 2 commits intoDevoLearn:mainfrom
Open
Fix: edge_feat_embedding crashes on empty edge_index when normalized_features=True*#50atharrva01 wants to merge 2 commits intoDevoLearn:mainfrom
atharrva01 wants to merge 2 commits intoDevoLearn:mainfrom
Conversation
Guard against zero-edge windows before calling normalize_array, which fails with ValueError when fit on 0-sample arrays. Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
Contributor
Author
|
hi @devoworm this pr fixed a crash in edge_feat_embedding where I hit a ValueError from MinMaxScaler on empty edge_index when normalized_features=True |
Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
Contributor
Author
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.

What I found broken
Commit 6562728 fixed
create_graphto producetorch.empty((2, 0))for edge-free windows butedge_feat_embeddingwas never updated to handle that. Withnormalized_features=True(the default), I kept hitting this:The scaler blows up on a zero-row array and the entire
process()call aborts. One sparse window is enough to kill the whole dataset build.Why I think this matters
Biologically sparse windows - early embryonic stages, filtered subregions, transient lineage gaps, are completely normal in developmental datasets. This isn't some weird edge case, it's expected data. The prior fix gave the impression empty edges were handled end-to-end, but the invariant broke right at the very next function call. On top of that, a partial
process()run leaves a corrupt.ptfile on disk, which quietly wrecks experiment reproducibility.What I changed
I added a 2-line early return at the top of
edge_feat_embedding:torch.FloatTensorhandles the empty(0, F)array fine, the nan check passes cleanly on an empty tensor, andData(edge_feat=...)accepts it without issue. Nothing changes for non-empty graphs , I made sure of that.