Add TensorNames::checkUnique, operator<< (TensorName) (#29124)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29124
TensorNames::checkUnique gives a nice error message if there are
duplicate names.
Adding operator<< on TensorName cleans up some code. A TensorName gets
printed out as: "'H' (index 2 of ['N', 'C', 'H', 'W'])" for example.
Test Plan: - New c++ tests. test with `build/bin/NamedTensor_test`.
Differential Revision: D18311868
Pulled By: zou3519
fbshipit-source-id: 5be197dba227f0328b40d7f66e78fffefe4dbd00