Make storage access throw for meta tensors (#53681)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53681
Without throwing, we can easily segfault trying to access nullptr
storage.
To do this I made set_storage_access_should_throw public so that you
don't have to subclass TensorImpl to do it. An alternative is
to just bite the bullet and add a MetaTensorImpl subclass. Let
me know what is preferred.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: Imported from OSS
Reviewed By: bhosmer
Differential Revision: D26955540
Pulled By: ezyang
fbshipit-source-id: 8ce22dd07ef1beb042f1d91de981954d59c2f84a