malllabiisc / asap Goto Github PK
View Code? Open in Web Editor NEWAAAI 2020 - ASAP: Adaptive Structure Aware Pooling for Learning Hierarchical Graph Representations
License: Apache License 2.0
AAAI 2020 - ASAP: Adaptive Structure Aware Pooling for Learning Hierarchical Graph Representations
License: Apache License 2.0
hi, this is an instresting and excellent paper! After reading the code, i have a problem about the partion of LEConv.py.
`def forward(self, x, edge_index, edge_weight=None, size=None):
num_nodes = x.shape[0]
h = torch.matmul(x, self.weight)
if edge_weight is None:
edge_weight = torch.ones((edge_index.size(1), ),
dtype=x.dtype,
device=edge_index.device)
edge_index, edge_weight = remove_self_loops(edge_index=edge_index, edge_attr=edge_weight)
deg = scatter_add(edge_weight, edge_index[0], dim=0, dim_size=num_nodes) # + 1e-10
h_j = edge_weight.view(-1, 1) * h[edge_index[1]]
aggr_out = scatter_add(h_j, edge_index[0], dim=0, dim_size=num_nodes)
out = ( deg.view(-1, 1) * self.lin1(x) + aggr_out) + self.lin2(x) # ----------the question is here----------#
edge_index, edge_weight = add_self_loops(edge_index=edge_index, edge_weight=edge_weight, num_nodes=num_nodes)
return out`
According to the paper's description, i think the caculation of out may as follows:
out = ( deg.view(-1, 1) * self.lin1(x) - aggr_out) + self.lin2(x)
i may be wrong and I want to know where my understanding has gone wrong. Can you explain that?
Thank you~
hello,
Thanks for the code sharing.
Is there any reason to convert tensor to cpu during StAS?
index_E, value_E =spspmm(index_St.cpu(), value_St.cpu(), index_B.cpu(), value_B.cpu(), kN, N, kN)
Instead of directly compute in gpu?
index_E, value_E = spspmm(index_St, value_St, index_B, value_B, kN, N, kN)
When I use torch==1.4, torch geometric==1.4.3, torch-sparse==0.6.1 it will cause a NAN error. But directly calculating in GPU is correct.
Hi I tried running your code using the command given and on CPU I get the following error:
File "main.py", line 252, in <module>
val_acc, test_acc = model.run()
File "main.py", line 167, in run
train_loss = self.run_epoch(train_loader)
File "main.py", line 67, in run_epoch
out = self.model(data)
File "/usr1/home/rjoshi2/envs/torch140/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "/usr1/home/rjoshi2/negotiation_personality/src/negotiation/predict_strategy/ASAP/asap_pool_model.py", line 46, in forward
x = F.relu(conv(x=x, edge_index=edge_index, edge_weight=edge_weight))
File "/usr1/home/rjoshi2/envs/torch140/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "/usr1/home/rjoshi2/envs/torch140/lib/python3.7/site-packages/torch_geometric/nn/conv/gcn_conv.py", line 102, in forward
x.dtype)
File "/usr1/home/rjoshi2/envs/torch140/lib/python3.7/site-packages/torch_geometric/nn/conv/gcn_conv.py", line 83, in norm
return edge_index, deg_inv_sqrt[row] * edge_weight * deg_inv_sqrt[col]
IndexError: index 4635 is out of bounds for dimension 0 with size 2631
In line 46 of your asap_pool_model file, I saw the shapes of x, edge_index and edge_weight. I even saw the max value of edge_index :
((Pdb) x.shape
torch.Size([2631, 64])
(Pdb) edge_index.shape
torch.Size([2, 58576])
(Pdb) edge_weight.shape
torch.Size([58576])
(Pdb) torch.max(edge_index)
tensor(5206)
(Pdb) x = F.relu(conv(x=x, edge_index=edge_index, edge_weight=edge_weight))
*** IndexError: index 4635 is out of bounds for dimension 0 with size 2631
Could you help me debug this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.