[PyTorch] Move Tensor::has_names inline (#54965)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/54965
Yet another small getter that should be inlineable.
ghstack-source-id: 125338544
Test Plan:
Framework overhead benchmark w/o arguments
Before:
```
I0329 13:56:41.268244 447880 bench.cpp:186] Mean 0.562635
I0329 13:56:41.268270 447880 bench.cpp:187] Median 0.562465
I0329 13:56:41.268276 447880 bench.cpp:188] Min 0.561757
I0329 13:56:41.268285 447880 bench.cpp:189] stddev 0.000707741
I0329 13:56:41.268292 447880 bench.cpp:190] stddev / mean 0.0012579
```
After:
```
I0329 14:32:34.116181 607857 bench.cpp:186] Mean 0.557326
I0329 14:32:34.116206 607857 bench.cpp:187] Median 0.557194
I0329 14:32:34.116212 607857 bench.cpp:188] Min 0.556323
I0329 14:32:34.116219 607857 bench.cpp:189] stddev 0.000700897
I0329 14:32:34.116226 607857 bench.cpp:190] stddev / mean 0.00125761
```
So roughly 1% faster overall if I've done the mental arithmetic right?
Reviewed By: ezyang
Differential Revision: D27410928
fbshipit-source-id: 4e66d40c71f534f66deb9c64502fb35d0a5997bf