add support for _modules, reducing special casing of nn.Sequential (#29495)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29495
This PR adds support for `_modules`, making it so we no longer need to special case support for `nn.Sequential`. I was getting internal errors around the previous approach using `self.define()`, so i am adding this PR as part of the stack.
Fix for https://github.com/pytorch/pytorch/issues/28998
Test Plan: Imported from OSS
Differential Revision: D18412561
Pulled By: eellison
fbshipit-source-id: a8b24ebee39638fccf63b2701f65f8bb0de84faa