Have you try https://github.com/warmspringwinds/pytorch-cpp 186.
When I compiled pytorch-cpp, I got errors:

pytorch-cpp/src/pytorch.cpp:341:58: error: ‘Threshold_updateOutput’ was not declared in this scope
…
Any advise? Thanks.