make code simplify in get bufffers and parameters (#70399)
Summary:
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70399
Reviewed By: george-qi
Differential Revision: D33823535
Pulled By: khabinov
fbshipit-source-id: 8d1e49595da1f5cc14db7634a8c27556b02a5361
(cherry picked from commit 78bbb536142ee985df69d2f195a17427b97bb8ea)