mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE] Deprecate has_XYZ attributes (#103279)
Use [`__getattr__`](https://peps.python.org/pep-0562/) to raise warningwhen one tries to access `has_XYZ` methods and recommend appropriate `torch.backends.XYZ` methods Make respective properties in `torch._C` private (by prefixing them with underscore), to exclude from `from torch._C import *`. Added `warnings.simplefilter` to workaround Python-3.11 torch.compile lineinfo issue. Fixes https://github.com/pytorch/pytorch/issues/102484 Pull Request resolved: https://github.com/pytorch/pytorch/pull/103279 Approved by: https://github.com/janeyx99, https://github.com/Skylion007
This commit is contained in:
committed by
PyTorch MergeBot
parent
0496d70aa0
commit
4cfa06f706
@ -700,6 +700,7 @@ class TestIndexing(TestCase):
|
||||
boolIndices = torch.tensor([True, False, False], dtype=torch.bool, device=device)
|
||||
uint8Indices = torch.tensor([1, 0, 0], dtype=torch.uint8, device=device)
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter("always") # TODO: Remove me once #103355 is closed
|
||||
self.assertEqual(v[boolIndices].shape, v[uint8Indices].shape)
|
||||
self.assertEqual(v[boolIndices], v[uint8Indices])
|
||||
self.assertEqual(v[boolIndices], tensor([True], dtype=torch.bool, device=device))
|
||||
|
||||
Reference in New Issue
Block a user