on import, register class before defining it (#21182)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21182
ghimport-source-id: 2457a4306c0a72888bb8359a267fcd12b43f103a
Differential Revision: D15571334
Pulled By: suo
fbshipit-source-id: 26ca9dddb25df1b1eac2e17c70f682e20e08cb6d