Solved by ebarsoum in post #3 
              
              
                Writing directly in C++ is needed, for deployment, if your network topology is dynamic (depend on the inputs such as Tree) or you need to train in an environment that can’t have Python runtime. In most other cases, TorchScript (if the model has control flow or loop) or Trace is the way to go. Speed …