Fix assertion if NamedTensorMeta's num_names != tensor.dim (#25778)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25778
I don't know how this ever compiled, it was caught by an internal test.
Do we not set DEBUG when compiling in debug mode in OSS?
Test Plan
- [namedtensor ci]
Test Plan: Imported from OSS
Differential Revision: D17228393
Pulled By: zou3519
fbshipit-source-id: 441ad716a369ee99be4723318cf78e394f98becf