What's the C++ frontend? Why is avoiding templates so important? Why is Tensor a reference type? How do we simulate keyword arguments in C++? Where did the nn Module support in the C++ API come from? Why did we reimplement all modules in C++? How are modules implemented in C++? What are some performance challenges of writing Python in C++, and how are we working around them?

Further reading.

  • C++ frontend tutorial https://pytorch.org/tutorials/advanced/cpp_frontend.html
  • Writing Python in C++ (a manifesto) https://github.com/pytorch/pytorch/wiki/Writing-Python-in-cpp-(a-manifesto)
  • MaybeOwned PR https://github.com/pytorch/pytorch/pull/53317