torch.jit.SciptedFunction handle in C++

There are many tutorials on saving models into .pt file and loading them in C++. However I haven’t found any hint in documentation/tutorials on how to pass traced model through pybind (probably it is not a coincidence :slight_smile:). However I can see that traced/scripted model class torch.jit.ScriptedModel has pybind11’s metaclass, so there’s probably a bound class in C++ which will allow to write function taking object of that type as an input. I haven’t found it yet, maybe somebody already knows?

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.