Allow to get string references to strings inside torch::List (#39763)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39763
This is an ask from fluent. For performance reasons, they need a way to get read access to the std::string inside of a torch::List<std::string> without having to copy that string.
Instead of special casing std::string, we decided to give access to the underlying value. The API now looks like:
```cpp
torch::List<std::string> list = ...;
const std::string& str = list[2].toIValueRef().toStringRef();
```
ghstack-source-id: 106806840
Test Plan: unit tests
Reviewed By: ezyang
Differential Revision: D21966183
fbshipit-source-id: 8b80b0244d10215c36b524d1d80844832cf8b69a