forked from vllm-project/vllm
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c452a86
commit 7bc8316
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import torch | ||
import pytest | ||
from vllm._custom_ops import permute_cols | ||
from tests.kernels.utils import opcheck | ||
|
||
|
||
@pytest.mark.parametrize('shape', [(1, 512), (544, 4096), (67, 8192)]) | ||
@pytest.mark.parametrize('dtype', [torch.bfloat16, torch.float16]) | ||
def test_permute_cols(shape, dtype): | ||
x = torch.randn(shape, dtype=dtype).cuda() | ||
perm = torch.randperm(x.shape[1]).to(torch.int).cuda() | ||
opcheck(torch.ops._C.permute_cols, (x, perm)) | ||
y = permute_cols(x, perm) | ||
torch.testing.assert_close(y, x[:, perm]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters