Where is the source code of torch.spmm?

I have found torch.mm and got no luck of torch.spmm. Where can I find it? Thanks!

There is a trick: rgrep -w spmm tools/autograd/ gives

tools/autograd/templates/python_torch_functions.cpp:  {"spmm", (PyCFunction)THPVariable_mm, METH_VARARGS | METH_KEYWORDS | METH_STATIC, NULL},

so it dispatches to mm.
You found that already, if you had not, I could offer a writeup of how PyTorch functions are generated.

Best regards

Thomas

1 Like

Thank you for your reply. It helps a lot!