[easy] refactor signature flattening transform (#101886)
Move `ChangeInputOutputSignature` out of export function to avoid closed over variables that make dependencies hard to understand. Also rename it while we're at it.
Differential Revision: [D46029076](https://our.internmc.facebook.com/intern/diff/D46029076/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/101886
Approved by: https://github.com/tugsbayasgalan