Avoid refcount bump in IValue::toStringRef() (#42019)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/42019
According to benchmarks, this makes IValue::toStringRef() 3-4x as fast.
ghstack-source-id: 108451154
Test Plan: unit tests
Reviewed By: ezyang
Differential Revision: D22731354
fbshipit-source-id: 3ca3822ea7310d8593e38b1d3e6014d6d80963db