mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
flip the list-as-tuple behavior for short lists (#160794)
Per title, previously we started throwing noisy warnings, but given how popular this pattern was in our test suite decided to leave it as warning, not as silent behavior change for one release. Now `treatSequenceAsTuple` would return `true` in the only case where the sequence was indeed a tuple, so no need for a special function anymore. Pull Request resolved: https://github.com/pytorch/pytorch/pull/160794 Approved by: https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
5afa4187df
commit
febfc3ec03
@ -894,13 +894,10 @@ class TestIndexing(TestCase):
|
||||
# Generate a list of lists, containing overlapping window indices
|
||||
indices = [range(i, i + W) for i in range(0, N - W)]
|
||||
|
||||
for i in [len(indices), 100, 32]:
|
||||
for i in [len(indices), 100, 32, 31]:
|
||||
windowed_data = t[indices[:i]]
|
||||
self.assertEqual(windowed_data.shape, (i, W))
|
||||
|
||||
with self.assertRaisesRegex(IndexError, "too many indices"):
|
||||
windowed_data = t[indices[:31]]
|
||||
|
||||
def test_bool_indices_accumulate(self, device):
|
||||
mask = torch.zeros(size=(10,), dtype=torch.bool, device=device)
|
||||
y = torch.ones(size=(10, 10), device=device)
|
||||
|
||||
Reference in New Issue
Block a user