Skip to content

Commit 3e54c13

Browse files
authored
Merge pull request #792 from Kaggle/add-cupy-test
Add cupy tests
2 parents 354a4eb + ee51094 commit 3e54c13

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_cupy.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import unittest
2+
3+
from common import gpu_test
4+
5+
6+
class TestCupy(unittest.TestCase):
7+
@gpu_test
8+
def test_kernel(self):
9+
import cupy as cp
10+
x = cp.arange(6, dtype='f').reshape(2, 3)
11+
y = cp.arange(3, dtype='f')
12+
kernel = cp.ElementwiseKernel(
13+
'float32 x, float32 y', 'float32 z',
14+
'''if (x - 2 > y) {
15+
z = x * y;
16+
} else {
17+
z = x + y;
18+
}''',
19+
'my_kernel')
20+
r = kernel(x, y)
21+
22+
self.assertEqual((2, 3), r.shape)

0 commit comments

Comments
 (0)