fix compilation order for class methods (#20094)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/20094
ghimport-source-id: cea2887831fcda83d50adfd2ee8414dedbebe897
Reviewed By: shannonzhu
Differential Revision: D15197079
Pulled By: suo
fbshipit-source-id: b36d5f8c666372e82f6e47a3be70f6dc835cc6ab