Hi, Thanks for your reply.
But I should train model with C++ and save the model as JIT script. The reason why I should save model as JIT script is that the inference code can’t access to model structure(the model defination class). Thus, I should find a way to save model as JIT script using C++.
However, the code you provide above should pass Model instance as parameter, so It doesn’t meet my need.