Makes more of test_nn generic (#27137)
Summary:
test_nn.py will still require significant work to make generic, however I'm trying to break up the PRs into more manageable chunks.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27137
Differential Revision: D17718488
Pulled By: mruberry
fbshipit-source-id: 4d9359414838a1d2a957d7a334f6a5df6cb00aeb