Why we need DECLARE/DEFINE/REGISTER_DISPATCH mechanism?

As we can use native_functions.yaml to define dispatch, why we need DECLARE/DEFINE/REGISTER_DISPATCH mechanism at the same time?

Hi,

These two have different purposes.
The native_functions.yaml allows you to select the device and in general works at the level of the Dispatcher.
The dispatch macro is a trick closer to the old TH macros that allow to write code that is generic for different dtype as well!