PetarV- / GAT

Graph Attention Networks (https://arxiv.org/abs/1710.10903)
https://petar-v.com/GAT/
MIT License
3.15k stars 643 forks source link

Why use (adj.col, adj.row) instead of (adj.row, adj.col), the accuracy is higher? #44

Open LeungH opened 4 years ago

LeungH commented 4 years ago

Hi, Petar

Thanks for your great works!

I have some questions about the function preprocess_adj_bias() in utils/process.py

indices = np.vstack((adj.col, adj.row)).transpose() # This is where I made a mistake, I used (adj.row, adj.col) instead

I did some experiment, I can't understand why use (adj.col, adj.row) instead of (adj.row, adj.col), the accuracy is higher. Could you explain? Thanks a lot!

llan-ml commented 4 years ago

For anyone who is also confused, all sparse operations assume that the sparse tensor is row-major ordering, while (adj.row, adj.col) in numpy is column-major ordering. Thus, we need to use (adj.col, adj.row).