[PyTorch] Avoid heap allocations in inferUnsqueezeGeometry (#49497)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49497
Noticed this thing spending relatively most of its time in
malloc in perf. Optimize for typical tensor sizes.
ghstack-source-id: 119318388
Test Plan:
perf profile internal benchmark; saw inferUnsqueezeGeometry
go from 0.30% exclusive 0.47% inclusive to 0.11% exclusive 0.16%
inclusive.
Differential Revision: D25596549
fbshipit-source-id: 3bbd2031645a4b9fe6f49a77d41db46826d0f632