-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] allow multiple edge builders (#70)
* feat: allow multiple edge builders * fix: update CHANGELOG.md * fix: express as kwargs * feat: add test for concat_edges() * fix: changelog * Update src/anemoi/graphs/create.py * fix: add deprecation warning * feat: add BooleanNot operation * fix: type hint * fix: issue with low cutoff_factor --------- Co-authored-by: Dieter Van den Bleeken <[email protected]>
- Loading branch information
1 parent
85c9c74
commit d5a35f0
Showing
7 changed files
with
106 additions
and
80 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import numpy as np | ||
import torch | ||
|
||
from anemoi.graphs.utils import concat_edges | ||
|
||
|
||
def test_concat_edges(): | ||
edge_indices1 = torch.tensor([[0, 1, 2, 3], [-1, -2, -3, -4]], dtype=torch.int64) | ||
edge_indices2 = torch.tensor(np.array([[0, 4], [-1, -5]]), dtype=torch.int64) | ||
no_edges = torch.tensor([[], []], dtype=torch.int64) | ||
|
||
result1 = concat_edges(edge_indices1, edge_indices2) | ||
result2 = concat_edges(no_edges, edge_indices2) | ||
|
||
expected1 = torch.tensor([[0, 1, 2, 3, 4], [-1, -2, -3, -4, -5]], dtype=torch.int64) | ||
|
||
assert torch.allclose(result1, expected1) | ||
assert torch.allclose(result2, edge_indices2) |