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

Modify custom torch.autograd.Functions to use setup_context instead of passing ctx as an argument to forward #37

Open
tvercaut opened this issue Jun 8, 2023 · 1 comment

Comments

@tvercaut
Copy link
Member

tvercaut commented Jun 8, 2023

See https://pytorch.org/docs/master/notes/extending.func.html
This should help make our code compatible with vmap

@theo-barfoot
Copy link
Collaborator

I have given this a go. See: SparseMatMul on the batched-mm-vmap branch.

This implementation only works for the forward pass of the COO batched mm.

It fails for:

  • COO backward: [undefined]NotImplementedError: Could not run 'aten::select_backward' with arguments from the 'SparseCPU' backend
  • CSR foward: Failed: [undefined]RuntimeError: Sparse CSR tensors do not have strides
  • CSR backward: [undefined]RuntimeError: Sparse CSR tensors do not have strides

The CSR methods fails (at least in the first instance) due to the function _add_batch_dim not supporting CSR tensors.

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

When branches are created from issues, their pull requests are automatically linked.

2 participants