已合并
fix torch.randint testcases #30889
chaijinwei创建于 2月13日
fix torch.randint testcases #30889
已合并
共 1 个文件变更+3-1
| @@ -14,7 +14,9 @@ class TestDLPack(TestCase): | |||
| 14 | # Create original tensor | 14 | # Create original tensor |
| 15 | if dtype == torch.bool: | 15 | if dtype == torch.bool: |
| 16 | original = torch.randint(0, 2, (2, 3, 4), dtype=dtype, device=device) | 16 | original = torch.randint(0, 2, (2, 3, 4), dtype=dtype, device=device) |
| 17 | - elif dtype in [torch.int8, torch.int16, torch.int32, torch.int64, torch.uint8]: | 17 | + elif dtype == torch.uint8: |
| 18 | + original = torch.randint(0, 10, (2, 3, 4), dtype=dtype, device=device) | ||
| 19 | + elif dtype in [torch.int8, torch.int16, torch.int32, torch.int64]: | ||
| 18 | original = torch.randint(-10, 10, (2, 3, 4), dtype=dtype, device=device) | 20 | original = torch.randint(-10, 10, (2, 3, 4), dtype=dtype, device=device) |
| 19 | else: | 21 | else: |
| 20 | original = torch.randn(2, 3, 4, dtype=dtype, device=device) | 22 | original = torch.randn(2, 3, 4, dtype=dtype, device=device) |