[PyTorch] Use DimVector for inputs to as_strided that don't grow dim (#55016)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55016
When we call as_strided() and don't add an extra dimension, we should continue to expect that the number of dimensions will fit in a DimVector and thus that using it will save heap allocations.
ghstack-source-id: 125337281
Test Plan: Existing CI
Reviewed By: ngimel
Differential Revision: D27452838
fbshipit-source-id: 8b3d118de322638c0c0e3a4bfcfb3c820c64e6cc