(self)
| 12 | |
| 13 | class TestTorchBackend(unittest.TestCase): |
| 14 | def test_randperm_generator_out(self): |
| 15 | n = 10 |
| 16 | out = torch.empty(n, dtype=torch.long, device=device) |
| 17 | res = torch.randperm(n, out=out).cpu().numpy() |
| 18 | np.testing.assert_equal(set(res), set(range(n))) |
| 19 | np.testing.assert_equal(out.cpu().numpy(), res) |
| 20 | |
| 21 | res2 = torch.randperm(n).cpu().numpy() |
| 22 | np.testing.assert_equal(set(res2), set(range(n))) |
| 23 | |
| 24 | def test_numpy_ones(self): |
| 25 | a = torch.ones(4, device=device) |
nothing calls this directly
no test coverage detected