muhanzhang / pytorch_DGCNN

PyTorch implementation of DGCNN
MIT License
372 stars 122 forks source link

adjacency matrix generation #53

Open mingyangligithub opened 1 year ago

mingyangligithub commented 1 year ago

Dear authors,

Thanks for your work! It provides a very detailed example of graph classification. I have some confusions when I studied the code. Could you please give me some help on them? Thank you very much!

In the file DGCNN_embedding --> gnn_lib --> PrepareSparseMatrices, the function generates adjacency matrix (eg. n2n_idxes) randomly using Longtensor 'n2n_idxes = torch.LongTensor(2, total_num_edges 2)'. Shouldn't it depend on the graph? The code bellow it 'n2n_vals = torch.FloatTensor(total_num_edges 2)' generates float values randomly. Shouldn't just be 1?

When I reproduced the programme, there was an error here '[sparse.FloatTensor: size is inconsistent with indices]'. There is a solution about this error: 'I think, you may try the code below n2n_idxes = torch.LongTensor(torch.randint(1, num_nodes, [2, num_edges 2])) instead of n2n_idxes = torch.LongTensor(2, num_edges 2)'

I think the problem I met is the initial code generates long tensor like 5051019120366827712, but it is out of range of the size n2n_sp, which is [total_num_nodes, total_num_nodes]. So the solution tries to generate index between number 1 to total_num_nodes. Yeah, it also means that the index is generated randomly. How to solve this running error? Is randomly generation correct?

Thanks again!

Best regards