[PyTorch][jit] Cache TupleType objects in getTypePtr (#66340)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/66340
For functions that take `std::vector`s with `std::tuple`s in them, `getTypePtr` can get hit on every call, in which case creating a new `TupleType` object every time is expensive.
ghstack-source-id: 140143104
Test Plan: CI
Reviewed By: hlu1, JasonHanwen
Differential Revision: D31514792
fbshipit-source-id: 23652ca90ba1259afc05e953b99ce1fe1bebcc2b