[PyTorch] Fix waste in unfold() (#55339)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55339
Use DimVector. Avoid calling size()/stride() when we know argument is in bounds.
ghstack-source-id: 125839415
Test Plan: Existing CI
Reviewed By: hlu1
Differential Revision: D27577647
fbshipit-source-id: b33057c383037dd0865de3a944ebf225ad8d9169