Factor out structured generation into its own subclass. (#51583)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51583
There are no substantive changes in this PR. The cluster of structured
helper methods is now split off into its own class. To make sure all of
the original closure was available, I subclassed RegisterDispatchKey and
passed it all on; the only new thing closed over is the structured
functions group being processed. I also renamed all the methods to
remove structured_ from their names as it is now redundant.
Most of the benefit is being able to remove a level of indentation
from gen_one.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: Imported from OSS
Reviewed By: bhosmer
Differential Revision: D26209872
Pulled By: ezyang
fbshipit-source-id: 76c11410a24968d4f3d8a2bbc9392251a7439e6e