Solved by fatvlad in post #2 
              
              
                If anyone else is interested, C++ class that is bound to torch.jit.ScriptedModel is torch::jit::StrongFunctionPtr. But using binding directly is not advised because you will need ABI-compatible version of pybind11 and there’s a chance that some binding make use of private symbols.