[PyTorch] Add DimVector variant of infer_size (#54882)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/54882
Sometimes we have no reason to think that the output of `infer_size` won't be within the range of typical tensor sizes. In those cases, we can use a DimVector.
ghstack-source-id: 125137792
Test Plan: CI
Reviewed By: ezyang
Differential Revision: D27400387
fbshipit-source-id: 9a11d0f93010540f3aa65c0e208fc8e03f0e8a7f