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

Conversion from CSR to BCSR #6

Open
jselvam11 opened this issue Mar 30, 2024 · 3 comments
Open

Conversion from CSR to BCSR #6

jselvam11 opened this issue Mar 30, 2024 · 3 comments

Comments

@jselvam11
Copy link

jselvam11 commented Mar 30, 2024

Hi,

This library seems really innovative. I would like to convert the CSR result from https://www.open3d.org/docs/release/python_api/open3d.ml.torch.ops.fixed_radius_search.html.

returns (for example)

neighbors_index = [1, 4, 4]
neighbors_row_splits = [0, 1, 2, 3]
neighbors_distance = []

as torch Tensors

to the Matrix BCSR format introduced in this library. Is there an intuitive way of doing this transformation?

@tgale96
Copy link
Collaborator

tgale96 commented Apr 1, 2024

Hi, thanks! Is the matrix that you have encoded in CSR block-sparse? It will need to be to exploit BSCR and block-sparse computation.

If it is, the conversion should be fairly simple? A simple way to get started would be to convert your matrix to dense and then to BSCR with stk.ops.to_sparse(...). Then we could optimized that transition to avoid going through dense.

@jselvam11
Copy link
Author

Took a further look and visualized the sparsity by plotting the csr matrix using pyplot.spy, seems like there are banded regions with block sparse patterns.

Some context, I am trying to learn the association between points and their neighbors which are sparsely represented through an MLP, but my current approach requires me to create a dense tensor from the CSR result which results in me running out of GPU memory. I saw the SparseMLP implementation in megablocks and thought about giving it a shot.

@tgale96
Copy link
Collaborator

tgale96 commented Apr 3, 2024

Oh interesting! Is there a reason you can use the built-in types/ops for unstructured sparsity in PyTorch?

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

2 participants