Revert "Make torch.device usable as a context manager (#91525)"

This reverts commit 619d52a5d296bc236ac98f40c7f7de54ab7c9d37.

Reverted https://github.com/pytorch/pytorch/pull/91525 on behalf of https://github.com/mehtanirav due to Internal breakages
This commit is contained in:
PyTorch MergeBot
2023-01-05 21:34:50 +00:00
parent c73147f741
commit f571ae4fdb
12 changed files with 90 additions and 401 deletions

View File

@ -760,7 +760,7 @@ class Wrapper:
val = getattr(self._data, name)
# If it's a method
if not isinstance(val, torch.device) and callable(val):
if callable(val):
c = getattr(type(self._data), name)
# Don't append self to args if classmethod/staticmethod
if c is val: