I’m trying to use the deformable convolutions cpp extensions from the mmdetection repo without a
setup.py but by compiling them just in time with
torch.utils.cpp_extension.load() as suggested here. However, I’m having some trouble giving the
load() function the correct path.
My folder structure is as follows:
├── dcn │ ├── deform_conv.py │ ├── deform_pool.py │ ├── __init__.py │ └── src │ ├── deform_conv_cuda.cpp │ ├── deform_conv_cuda_kernel.cu │ ├── deform_pool_cuda.cpp │ └── deform_pool_cuda_kernel.cu └── test_dcn.py
test_dcn.py I import the deformable convolutions with
from dcn import DeformConvPack and in the file
deform_conv.py I inserted the following at the top:
# deform_conv.py from torch.utils.cpp_extension import load deform_conv_cuda = load(name='deform_conv_cuda', sources=['src/deform_conv_cuda.cpp', 'src/deform_conv_cuda_kernel.cu']) # Rest of the code # ...
I expected this to work but the compilation fails because the
.cu files cannot be found. If I instead specify the sources as
'dcn/src/deform_conv_cuda_kernel.cu' it works.
Could someone explain me the logic behind this? Thank you very much =)