About
This skill automates the transition from legacy PyTorch AT_DISPATCH macros to the newer V2 API found in aten/src/ATen/Dispatch_v2.h. It intelligently handles complex transformations, including reordering arguments to place scalar types and names first, wrapping lambdas with AT_WRAP to prevent C++ preprocessor comma parsing issues, and expanding type groups with AT_EXPAND. It is a critical tool for core PyTorch developers and contributors maintaining ATen kernels, CUDA implementations, or native operators who need to adopt the more flexible and composable dispatch patterns of the V2 API.