Skip to content
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

xformers.sparse.utils._coo_to_csr is incorrect when n > m #1125

Open
francois-rozet opened this issue Oct 11, 2024 · 0 comments
Open

xformers.sparse.utils._coo_to_csr is incorrect when n > m #1125

francois-rozet opened this issue Oct 11, 2024 · 0 comments

Comments

@francois-rozet
Copy link

🐛 Bug

_coo_to_csr is incorrect when n > m. This bug is caused by minlength=n, while it should be minlength=m.

def _coo_to_csr(m, n, row_indices, column_indices):
# assumes coalesced coo
row_offsets = row_indices.bincount(minlength=n).cumsum(0, dtype=row_indices.dtype)
row_offsets = torch.nn.functional.pad(row_offsets, (1, 0))
return row_offsets, column_indices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant