@botelho version is really matter to us since the serialize code keep changing between versions.
The example was written for libtorch 1.4, I think we need to update it.
There is a post here which can solve your problem. Please take a look at.
  
    
    
    (libtorch) How to save model in MNIST cpp example? C++
  
  
    I’m running mnist example and try to save trained model to disk: 
torch::save(model, "model.pt")   # save model using torch::save

Then got error as: 
In file included from /home/christding/env/libtorch/include/torch/csrc/api/include/torch/all.h:8:0,
                 from /home/christding/env/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/christding/Desktop/workspace/TorchLearning/C++/mnist-custom/src/mnist.cpp:1:
/home/christding/env/libtorch/include/torch/…