Add empty_generic, which allocates an empty tensor in a device-generic way (#54703)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/54703
The trick is that this function takes in the allocator and dispatch key
explicitly; so you still need to know where to find the appropriate
allocator. The plan is to use this for meta tensors, but you probably
could also use this for empty_cuda as well. It also takes in arguments
post optional resolution, which can save a few instructions if you want
to call this function directly (no uses yet).
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: Imported from OSS
Reviewed By: iseeyuan
Differential Revision: D27338814
Pulled By: ezyang
fbshipit-source-id: 131c97922d245e9a2de547527123b464bddb2f99