Improve efficiency of shape hash by not using tostring (#69496)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/69496
tostring is expensive, and this is equivalent and faster
Test Plan: covered by lazy tensor unit tests
Reviewed By: desertfire, alanwaketan
Differential Revision: D32901050
fbshipit-source-id: 34080f415db5fd5d3817f7f2533f062a6ec07d21