New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add an element to the diagonal #100
Comments
It will only fill the diagonal with values in case col = torch.tensor([1,1,5,0]).type(torch.long)
row = torch.tensor([2,5,3,0]).type(torch.long)
value = torch.tensor([1, 1, 1, 1].type(torch.float)
adj = SparseTensor(col=col, row=row, value=value) |
Thanks for the prompt answer.
So, I understand that What would be the simplest way to add to the diagonal instead of filling? |
I'm sorry for the lack of documentation :) In general, There's no easy way yet to add diagonal entries to existing ones, since sum is currently not implemented. |
That's bad news. I wanted to extent SIGN to more general propagation matrices. For that I need to add to the diagonal of an adjacency matrix. |
But for that, adding diagonal entries is sufficient, isn't it? No need to sum them up in case there already exists some. |
The idea is to define a continuum of propagation matrices. To make the problem more easily understandable, I will push a PR. |
We have a |
Getting diagonal entries is quite straightforward: row, col, value = A.coo()
diag_values = value[row == col] |
Thanks. |
Just pushed |
Just what I needed. Thanks. |
Currently, we can only set the diagonal elements of a sparse matrix by specifying a scalar, right ? Would it be possible to specify a tensor instead ? |
You can either fill with a scaler via |
This issue had no activity for 6 months. It will be closed in 2 weeks unless there is some new activity. Is this issue already resolved? |
* read_csv * update * update * update * update * update * add test * update * re-add column tuple
fix: fix errors regarding Reducer functionalities in segment.cpp
Hi,
I want to add a constant to the diagonal of a sparse matrix. Looking at GCNConv, I assume this is what
SparseTensor.fill_diag
does (it would be great if methods were documented).With
I got as expected
Further
returns
So, the diagonal is filled with 1s, instead of 4s. What is wrong with my code?
Thanks for any help.
The text was updated successfully, but these errors were encountered: