GCN_Partitioning icon indicating copy to clipboard operation
GCN_Partitioning copied to clipboard

pytorch ops for element-wise division and product

Open chenmagi opened this issue 2 years ago • 2 comments

Hi,

Because my graph adjacency is large as (100k x 100k) nodes, I plan to use torch's SparseTensor for storing data. I noticed that you implemented a custom loss with a backward function. Is it possible to use SparseTensor and autograd?

chenmagi avatar Sep 08 '23 04:09 chenmagi

Hi! This repository is a bit old but I think you can do that. However, it is going to be slow as the loop is written in Python, if you can rewrite the backward in C/Cuda using the equations I have posted, it should be much faster.

saurabhdash avatar Sep 09 '23 09:09 saurabhdash

Hi

As per my experiment, the most workload of the custom backward function is on getting the edge index from the sparse array, which is alpha_ind = (idx[0, :] == i).nonzero(). If we pre-calculate the alpha_ind for each node, that would be a good performance improvement.

chenmagi avatar Sep 12 '23 02:09 chenmagi