Skip to content

Commit

Permalink
GraphConv now adative for out-of-bound k.
Browse files Browse the repository at this point in the history
Signed-off-by: Shivam Pandey <pandeyshivam2017robotics@gmail.com>
  • Loading branch information
ShivamPR21 committed Jun 30, 2023
1 parent a1c4832 commit 590e9c6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions moduleZoo/graphs/grah_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
def get_graph_features(x: torch.Tensor, idx: torch.Tensor | None = None, k: int | None = None, mode: str = 'local+global') -> torch.Tensor:
B, n, d = x.size() # [B, n, d]

k = min(n, k) if idx is None else k

features = knn_features(x, idx, k) # [B, n, k, d]
x = x.view(B, n, 1, d).repeat(1, 1, k, 1) # [B, n, k, d]

Expand Down

0 comments on commit 590e9c6

Please sign in to comment.