Last active
December 30, 2015 21:59
-
-
Save bayerj/7890721 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import theano | |
import theano.tensor as T | |
import theano.sandbox.cuda as cuda | |
from theano.printing import pydotprint | |
from theano.misc import pycuda_utils | |
from pycuda.gpuarray import zeros | |
import pycuda.driver as drv | |
import pycuda.autoinit | |
from pycuda.compiler import SourceModule | |
X = cuda.fmatrix() | |
A = cuda.vector() | |
indexed = X[T.cast(A, 'int32')] | |
f = theano.function([X, A], indexed) | |
x = pycuda_utils.to_cudandarray(zeros((2, 2), dtype='float32')) | |
a = pycuda_utils.to_cudandarray(zeros((4,), dtype='float32')) | |
pydotprint(f, 'simple.png') | |
print f(x, a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment