Catch saved tensors default hooks race condition
If the user runs code that registers default saved tensor hooks from
multiple threads, it will fail with a nice error message most of the
time. This commit handles the very rare case where a race condition
would have made it fail silently.
ghstack-source-id: 00341f81271b71f0db07913244fd7325519f72a6
Pull Request resolved: https://github.com/pytorch/pytorch/pull/61957