How to load Model in C++?

Hello world,

I want to run my Pytorch model written in python in C++. The model is serialized an this part works. When it comes to load the model in C++ I am very confused with the given tutorial to this topic.

Why does the main function take the arguments argc and argv?
Why do they use cmake?
Where is the path of the model given?
What is this thing actually doing?
Don’t I understand Pytorch or do I have a problem with C++? I never dealt with it bevor and every solution I find causes 3 other problems.

#include <torch/script.h> // One-stop header.

#include <iostream>
#include <memory>

int main(int argc, const char* argv[]) {
  if (argc != 2) {
    std::cerr << "usage: example-app <path-to-exported-script-module>\n";
    return -1;
  }

  // Deserialize the ScriptModule from a file using torch::jit::load().
  std::shared_ptr<torch::jit::script::Module> module = torch::jit::load(argv[1]);

  assert(module != nullptr);
  std::cout << "ok\n";
}