CuPy

https://cupy.chainer.org/


>>> x = cp.arange(6, dtype='f').reshape(2, 3)
>>> y = cp.arange(3, dtype='f')
>>> kernel = cp.ElementwiseKernel(
...     'float32 x, float32 y', 'float32 z',
...     '''if (x - 2 > y) {
...       z = x * y;
...     } else {
...       z = x + y;
...     }''', 'my_kernel')
>>> kernel(x, y)
array([[ 0.,  2.,  4.],
       [ 0.,  4.,  10.]], dtype=float32)
           

<!– –>

Leave a Reply

Your email address will not be published. Required fields are marked *

Next Post

The State of American Trade Schools

Tue Apr 16 , 2019
https://www.popularmechanics.com/technology/a26789417/trade-schools/

You May Like