Last active
October 20, 2017 20:04
-
-
Save arendu-zz/d4ec97d90549f13e0027c2eb26d815de to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
__author__ = 'arenduchintala' | |
import theano | |
import theano.tensor as T | |
import numpy as np | |
a = T.vector('a') | |
M = T.matrix('M') | |
func = theano.function(inputs=[a,M], outputs=T.dot(M,a)) | |
a_np = np.float32(np.random.rand(10,)) | |
M_np = np.float32(np.random.rand(10,10)) | |
func(a_np, M_np) |
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
#!/usr/bin/env python | |
__author__ = 'arenduchintala' | |
import torch | |
from torch import cuda | |
import sys | |
print cuda.is_available() | |
#device = int(sys.argv[1]) #get via `free-gpu` in the command line | |
cuda.set_device(0) | |
print cuda.current_device() | |
#make a random tensor and copy it to the gpu | |
tmp = torch.rand(5,5) | |
tmp.cuda() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment