Most of the core PyTorch functions on the torch package and on torch.Tensor are generated from Declarations.yaml (*) using gen_python_functions.cpp 87. The generated files look like:
python_torch_functions.cpp 89
python_variable_methods.cpp 25
We don’t use pybind11 here for a few reasons:

We need to disambiguate multiple overloads in a PyTorch-specific way. Some of this behavior is due to historical Lua Torch function signatures. We try to avoid this ambiguity in new functions.
pybind11 tends to slow down compile time a lot

(*) Declarations.yaml 57 is generated from native_functions.yaml 21. There used to be other inputs that went into Declarations.yaml, but I’m not sure if that’s still the case. Anyways, Declarations.yaml is intended as the “public” machine-readable API specification for things like language bindings.