Refactor dispatcher (#17753)
Summary:
This is a side PR for a bool tensor feature. The idea of this change came from a feedback received in this [PR](https://github.com/pytorch/pytorch/pull/17376).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17753
Differential Revision: D14367989
Pulled By: izdeby
fbshipit-source-id: 4fa380e56e20f18e480be68920170dbc3a4eb91c