MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / test_argsort_ascending

Function test_argsort_ascending

tests/test_tl_argsort.py:61–70  ·  view source on GitHub ↗
(N)

Source from the content-addressed store, hash-verified

59
60@pytest.mark.parametrize("N", [16, 64, 128, 256])
61def test_argsort_ascending(N): # noqa: N803
62 x = torch.randn(N, dtype=torch.float32, device="cuda")
63 out_vals = torch.empty_like(x)
64 out_ids = torch.empty(N, dtype=torch.int32, device="cuda")
65
66 argsort_asc_kernel[(1,)](x, out_vals, out_ids, N=N)
67
68 expected_vals, expected_ids = torch.sort(x, descending=False)
69 assert torch.allclose(out_vals, expected_vals)
70 assert torch.equal(out_ids, expected_ids.to(torch.int32))
71
72
73def test_argsort_2d():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected