It looks like the custom kernels in the repo linked are bound using pybind (https://github.com/CharlesShang/DCNv2/blob/master/src/vision.cpp 38). So they will not work with TorchScript as is. However, it is possible to register the operator with TorchScript following https://pytorch.org/tutorials/advanced/torch_script_custom_ops.html 75, which would work with TorchScript.