refactor self to be a class again (#22207)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/22207
ghimport-source-id: 36ee8bd17411a2e220665ad2a27364653061070e
Test Plan: Imported from OSS
Differential Revision: D15998758
Pulled By: suo
fbshipit-source-id: 14bad87bb6e44bf1a43ae86339d8cc7b311c76dd