Skip to content

Commit 12869c7

Browse files
authored
Merge pull request #26 from danielzuegner/master
Break ties in adjacency matrix construction
2 parents ec47c8a + c2c2fd3 commit 12869c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def forward(self, idx):
184184
adj = F.relu(torch.tanh(self.alpha*a))
185185
mask = torch.zeros(idx.size(0), idx.size(0)).to(self.device)
186186
mask.fill_(float('0'))
187-
s1,t1 = adj.topk(self.k,1)
187+
s1,t1 = (adj + torch.rand_like(adj)*0.01).topk(self.k,1)
188188
mask.scatter_(1,t1,s1.fill_(1))
189189
adj = adj*mask
190190
return adj

0 commit comments

Comments
 (0)