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

Function test_argsort_descending

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

Source from the content-addressed store, hash-verified

46
47@pytest.mark.parametrize("N", [16, 64, 128, 256])
48def test_argsort_descending(N): # noqa: N803
49 x = torch.randn(N, dtype=torch.float32, device="cuda")
50 out_vals = torch.empty_like(x)
51 out_ids = torch.empty(N, dtype=torch.int32, device="cuda")
52
53 argsort_desc_kernel[(1,)](x, out_vals, out_ids, N=N)
54
55 expected_vals, expected_ids = torch.sort(x, descending=True)
56 assert torch.allclose(out_vals, expected_vals)
57 assert torch.equal(out_ids, expected_ids.to(torch.int32))
58
59
60@pytest.mark.parametrize("N", [16, 64, 128, 256])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected