Created
March 18, 2020 09:45
-
-
Save xuuuluuu/ebe503f18b777dc64589232bdb13fa8e to your computer and use it in GitHub Desktop.
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
new_adj = torch.triu(adj, diagonal=1) | |
# print(new_adj[-1, :10, :10]) | |
new_adj1 = torch.bmm(new_adj, new_adj) | |
# print(new_adj1[-1, :10, :10]) | |
new_adj_or = torch.clamp((new_adj + new_adj1), max=1) | |
# print('new_adj_or', new_adj_or[-1, :10, :10]) | |
loop = 1 | |
while not torch.equal(torch.bmm(new_adj_or, new_adj_or), new_adj1): | |
new_adj1 = torch.bmm(new_adj_or, new_adj_or) | |
new_adj_or = torch.clamp((new_adj_or + new_adj1), max=1) | |
loop += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment