You can see my code in https://github.com/artbataev/end2end 70, tested with Pytorch 1.3
I think it is far from ideal, but it works. If you have some questions, I will try to answer.
https://github.com/artbataev/end2end/blob/master/setup.py 23 - building in setup.py
https://github.com/artbataev/end2end/blob/master/CMakeLists.txt 61 - basic project CMake file
https://github.com/artbataev/end2end/blob/master/pytorch_end2end/src/CMakeLists.txt 38 - compiling pytorch plugin
I haven’t found a good solution for the problem with CUDNN, but it’s possible to specify cudnn path manually.