Convert back from a dense batch to a sparse batch #4540
Unanswered
AnimeshSinha1309
asked this question in
Q&A
Replies: 1 comment
-
You should be able to do x = x.view(-1, x.size(-1)
edge_index, edge_weight = torch_geometric.utils.dense_to_sparse(adj) As you said, this will return a lot of edges (due to how these dense pooling approaches work) which may be utterly inefficient. You may be able to reduce the number of edges by filtering them out based on mask = edge_weight > 0.2
edge_index, edge_weight = edge_index[:, mask], edge_weight[mask] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I need to use the
pyg.utils.to_dense_batch
function for gettingdense_mincut_pooling
to work.Now, for the future layers, the tutorial on
dense_mincut_pooling
shows that we need to useDenseGraphConv
layers.However, there are some custom layers that I have implemented which do not have their Dense versions.
So is there some way, even if it is computationally inefficient, to undo the
to_dense_batch
function and get a sparse batch back.I can't find a function called
to_sparse_batch
, is that by design?Beta Was this translation helpful? Give feedback.
All reactions