Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions topomodelx/nn/hypergraph/hypergat_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
Attention weights: one scalar per message between a source and a target cell.
"""
if mechanism == "node-level":
x_source_per_message = x_source[self.target_index_i]
x_source_per_message = x_source[self.source_index_j]
return torch.nn.functional.softmax(
torch.matmul(
torch.nn.functional.leaky_relu(x_source_per_message),
Expand All @@ -122,11 +122,11 @@
dim=1,
)

x_source_per_message = x_source[self.source_index_j]
x_source_per_message = x_source[self.target_index_i]
x_target_per_message = (
x_source[self.target_index_i]
if x_target is None
else x_target[self.target_index_i]
else x_target[self.source_index_j]
)

x_source_target_per_message = torch.nn.functional.leaky_relu(
Expand Down Expand Up @@ -183,7 +183,7 @@
Output hyperedge features.
"""
intra_aggregation = incidence_1.t() @ (x_0 @ self.weight1)

Check failure on line 186 in topomodelx/nn/hypergraph/hypergat_layer.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (W293)

topomodelx/nn/hypergraph/hypergat_layer.py:186:1: W293 Blank line contains whitespace
self.target_index_i, self.source_index_j = incidence_1.indices()

attention_values = self.attention(intra_aggregation).squeeze()
Expand All @@ -200,7 +200,7 @@
inter_aggregation = incidence_1 @ (messages_on_edges @ self.weight2)

attention_values = self.attention(
inter_aggregation, intra_aggregation
inter_aggregation, intra_aggregation, "edge-level"
).squeeze()
incidence_with_attention = torch.sparse_coo_tensor(
indices=incidence_1.indices(),
Expand Down
Loading