mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
fix torch.prod vectorized path for bool (#128009)
Fix https://github.com/pytorch/pytorch/issues/127866. Pull Request resolved: https://github.com/pytorch/pytorch/pull/128009 Approved by: https://github.com/jgong5, https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
89929d9abc
commit
2ba60a1618
@ -1498,7 +1498,13 @@ class TestReductions(TestCase):
|
||||
self.assertEqual(res1, res2.to(dtype=dtype))
|
||||
|
||||
def test_prod_bool(self, device):
|
||||
vals = [[True, True], [True, False], [False, False], []]
|
||||
vals = [
|
||||
[True, True],
|
||||
[True, False],
|
||||
[False, False],
|
||||
[],
|
||||
[False] * 256, # https://github.com/pytorch/pytorch/issues/127866
|
||||
]
|
||||
for val in vals:
|
||||
result = torch.prod(torch.tensor(val, device=device), dtype=torch.bool).item()
|
||||
expect = np.prod(np.array(val), dtype=bool)
|
||||
|
Reference in New Issue
Block a user