Make pin_memory/is_pinned use BackendSelect (#60547)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/60547
These now dispatch on the optional Device argument, which specifies
what device you want to pin for. We now directly register pinned
memory implementations for CUDA specifically, eliminating the need
for extra virtual methods.
This makes it possible for other backends to override the behavior
of pinned memory, c.f. https://github.com/pytorch/pytorch/pull/59291
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: Imported from OSS
Reviewed By: albanD, bdhirsh
Differential Revision: D29331881
Pulled By: ezyang
fbshipit-source-id: db3b4e2c872ba1caa0243fecc60a4da65179ce28