Solved by tom in post #2 
              
              
                I don’t think PyTorch supports that. 
You would likely need to define a wrapper library with extern “C” functions and compile that in C++. The wrapper can then be called from C. 
Best regards 
Thomas