See this:

  
    
    
    Broken API in libtorch 1.2 C++
  
  
    Yes the PyTorch C++ API is still considered “beta” stability. Specifically, we changed torch::jit::load(s_model_name) to return torch::jit::script::Module instead of std::shared_ptr<torch::jit::script::Module> because torch::jit::script::Module is now a reference type, and this change is documented in the release note ("[jit] script::Module is now a reference type" in https://github.com/pytorch/pytorch/releases/tag/v1.2.0).