theano

How to install Theano for Python 3.5 on Windows 10

徘徊边缘 提交于 2019-12-11 04:13:59
问题 I can't find how one is supposed to install Theano for Python 3.5 (Windows 10) only for Python 2.7. I don't want to have to downgrade to 2.7 so does anyone know how to install Theano for Python 3.5 (on Windows 10)? A clear set of step-by-step instructions would be greatly appreciated, as well as other things I need and how to install them. 回答1: To make this question more self contained I find it worth to add this answer: Winpython is the best!!, actually it is the recommended installation

Theano import Error-windows 7

孤街醉人 提交于 2019-12-11 03:57:55
问题 I have a problem in importing theano in python. When I import Theano in the python 27 32 bit, in Windows 7 64 bit, I get the following errors and warning: I also should add that currently I have installed GCC 4.8.1. What I have to do in order to fix it. Thanks, Afshin WARNING (theano.gof.cmodule): OPTIMIZATION WARNING: Theano was not able to find the g++ parameters that tune the compilation to your specific CPU. This can slow down the execution of Theano functions. Please submit the following

Matrices with different row lengths in numpy

て烟熏妆下的殇ゞ 提交于 2019-12-11 02:27:51
问题 Is there a way of defining a matrix (say m ) in numpy with rows of different lengths, but such that m stays 2-dimensional (i.e. m.ndim = 2)? For example, if you define m = numpy.array([[1,2,3], [4,5]]) , then m.ndim = 1. I understand why this happens, but I'm interested if there is any way to trick numpy into viewing m as 2D. One idea would be padding with a dummy value so that rows become equally sized, but I have lots of such matrices and it would take up too much space. The reason why I

Variable-length tensors in Theano

走远了吗. 提交于 2019-12-11 01:04:52
问题 This question refers to best practices in Theano. Here is what I am trying to do: I am building a neural network for an SMT system. In this context, I conceptually represent sentences as variable-length lists of words, and words as fixed-length lists of integers. Ideally, I would like to represent my corpus as a 3D tensor (first dimension = sentences in corpus, second dimension = words in sentence, third dimension = integer features in words). The difficulty is that sentences have variable

Theano version of a numpy einsum for two 3dim matrices

笑着哭i 提交于 2019-12-11 00:00:52
问题 I have two 3dim numpy matrices and I want to do a dot product according to one axis without using a loop in theano. a numpy solution with sample data would be like: a=[ [[ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [ 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [ 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [ 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0]], [[ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0], [ 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0], [ 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,

Dealing with memory fragmentation of GPUs in Theano

◇◆丶佛笑我妖孽 提交于 2019-12-10 22:45:05
问题 To allocate space to a variable on GPU memory there must be enough space on continuous memory region. In other words you cannot have fragmented memory regions allocated to a variable on GPUS, unlike RAM. Having different shared variables stored on the GPU memory and continuously updating them could cause memory fragmentation. Therefore, even if there is enough free memory (in terms of bytes) on the GPU, you may not be able to use those memory regions as they are not in a continuous block. My

Set last non-zero element of each row to zero - NumPy

筅森魡賤 提交于 2019-12-10 20:40:25
问题 I have an array A: A = array([[1, 2, 3,4], [5,6,7,0] , [8,9,0,0]]) I want to change the last non-zero of each row to 0 A = array([[1, 2, 3,0], [5,6,0,0] , [8,0,0,0]]) how to write the code for any n*m numpy array? Thanks, S ;-) 回答1: Approach #1 One approach based on cumsum and argmax - A[np.arange(A.shape[0]),(A!=0).cumsum(1).argmax(1)] = 0 Sample run - In [59]: A Out[59]: array([[2, 0, 3, 4], [5, 6, 7, 0], [8, 9, 0, 0]]) In [60]: A[np.arange(A.shape[0]),(A!=0).cumsum(1).argmax(1)] = 0 In [61

theano.test() : optimization failure due to constant_folding (on ubuntu)

会有一股神秘感。 提交于 2019-12-10 19:07:15
问题 When running theano.test() on an Ubuntu operating system, some error message about an optimization failure is produced as follows: ERROR (theano.gof.opt): Optimization failure due to: constant_folding ERROR (theano.gof.opt): TRACEBACK: ERROR (theano.gof.opt): Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/theano/gof/opt.py", line 1286, in process_node replacements = lopt.transform(node) File "/usr/local/lib/python2.7/dist-packages/theano/tensor/opt.py", line

convert python ndarray to theano tensor type variable

我只是一个虾纸丫 提交于 2019-12-10 19:06:37
问题 I have ndarray like : diag = [] diag.append(np.diag([1,1,0])) diag.append(np.diag([0,1,1])) diag [array([[1, 0, 0], [0, 1, 0], [0, 0, 0]]), array([[0, 0, 0], [0, 1, 0], [0, 0, 1]])] How can I convert it into Theano tensor variable of type float 64, matrix ? As I need to perform dot operation like Theano.dot(diag, X) where X is shared variable of type float 64, matrix. 回答1: Just create a SharedVariable like this diag_ = theano.shared(np.array(diag).astype("float64")) theano.dot(diag_, X) http:

theano gives “…Waiting for existing lock by unknown process…”

試著忘記壹切 提交于 2019-12-10 18:26:46
问题 My code was working fine. However, now I am getting an error that says: Using gpu device 0: GeForce GT 750M WARNING (theano.gof.cmodule): ModuleCache.refresh() Found key without dll in cache, deleting it. /Users/mas/.theano/compiledir_Darwin-14.5.0-x86_64-i386-64bit-i386-2.7.10-64/tmpcm9_P6/key.pkl INFO (theano.gof.compilelock): Waiting for existing lock by unknown process (I am process '2799') INFO (theano.gof.compilelock): To manually release the lock, delete /Users/mas/.theano/compiledir