It’s in the C++ modules (ATen to be precise).

aten/src/ATen/native/cudnn/AffineGridGenerator.cpp 389
found via aten/src/ATen/native/native_functions.yaml 48.

Personally, I tend to use the “rgrep” command on the PyTorch source tree to find functions.
Best regards
Thomas