does not work, as you need to load PyTorch itself and its symbols before you load the extension, so python -c "import torch, my_conv" would likely work much better.
If you wanted to avoid that for some reason, you could explicitly link against libtorch (extra_ldflags=['-ltorch'] or somesuch).
Thanks. import torch, my_conv works.
But when I run it
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: dynamic module does not define module export function (PyInit_my_conv)
It seems I need to write function warppers via Pybind11. But I don’t know how to warp a cuda function like this:
I think you need a rather to upgrade to from legacy THC to modern PyTorch (I think this has been looming for 2 years or so…). We don’t really do THCTensor* anymore, in fact there is an effort going on to migrate all these old bits internally as well.
torch::Tensor even. But you’ll likely also need to adapt what is inside the functions. It is a bit of work, but your code will look much better afterwards.