Make TensorName::unifyFromRight in-place for efficiency (#29307)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29307
In our name inference functions we currently create an extra TensorNames
every time we unify names. This isn't completely necessary.
To do this, I made the following changes:
- TensorName now has two states, initialized and uninitialized
- Renamed unifyFromRight to unifyFromRightInplace.
Test Plan: - `pytest test/test_namedtensor.py -v`
Differential Revision: D18453388
Pulled By: zou3519
fbshipit-source-id: 96c3c6fd9478d57e92e1cf770c864aeac6d29dd2