theano

Why do the environment variables set in command prompt have no effect when I start Spyder

流过昼夜 提交于 2019-12-11 09:43:29
问题 I am using the Spyder Anaconda IDE for Python. I am writing a code in the Spyder IDE that requires few environment variables to be set ($CPATH, $LIBRARY_PATH and $LD_LIBRARY_PATH) for the Theano library. I am starting Spyder using the command sudo ./spyder and it starts fine. Even though I set the environment variables in my /root/.bashrc file, the code still fails to accept the path and if I try printing print os.environ["LD_LIBRARY_PATH"] it raises a KeyError. I tried all the above with a

Using custom likelihood in PYMC3 leads to error with “expected ndarray”

China☆狼群 提交于 2019-12-11 09:39:55
问题 I'm trying to use a custom distribution (Generalized Extreme Value or GEV distribution) in PYMC3. I have written some code to compute this, but I get an error of ValueError: expected an ndarray Apply node that caused the error: MakeVector{dtype='float64'}( logp_sigma_log , __logp_mu, __logp_xi, __logp_x) Here's the code for reference: @theano.as_op(itypes=[tt.dvector, tt.dscalar, tt.dscalar, tt.dscalar], otypes=[tt.dscalar]) def likelihood_op(values, mu, sigma, xi): logp = 0. for val in

python.exe crashes when importing `theano`

回眸只為那壹抹淺笑 提交于 2019-12-11 08:55:24
问题 I am using Anaconda(2.2 64bit) on a Windows 7 64-bit machine. When I try to import theano Python crashes without infomation. I installed theano using Anaconda. Does anyone know where this problem comes from? 回答1: This could be caused by a missing, or incorrectly configured C compiler. There's a lot of help about installing Theano on Windows in the documentation. In particular, make sure you've run conda install mingw libpython 回答2: I solve this problem by using anaconda 2.10 instead of

Getting the learned representation of the data from the unsupervised learning in pylearn2

余生长醉 提交于 2019-12-11 08:13:00
问题 We can train an autoencoder in pylearn2 using below YAML file (along with pylearn2/scripts/train.py) !obj:pylearn2.train.Train { dataset: &train !obj:pylearn2.datasets.mnist.MNIST { which_set: 'train', start: 0, stop: 50000 }, model: !obj:pylearn2.models.autoencoder.DenoisingAutoencoder { nvis : 784, nhid : 500, irange : 0.05, corruptor: !obj:pylearn2.corruption.BinomialCorruptor { corruption_level: .2, }, act_enc: "tanh", act_dec: null, # Linear activation on the decoder side. }, algorithm:

ERROR (theano.gpuarray): Could not initialize pygpu, support disabled

瘦欲@ 提交于 2019-12-11 07:38:05
问题 I am trying to configure theano 0.9 to use gpu, but got such error. I use windows 10 with nvidia GeForce 940m and cuda 8. Previously my system works fine with theano 0.8 for gpu computation. I just updated the theano. ERROR (theano.gpuarray): Could not initialize pygpu, support disabled Traceback (most recent call last): File "C:\Users\YL\Anaconda2\lib\site- packages\theano\gpuarray\__init__.py", line 175, in <module> use(config.device) File "C:\Users\YL\Anaconda2\lib\site-packages\theano

theano, indexing a large matrix with relatively small value, but got out of boundary

≯℡__Kan透↙ 提交于 2019-12-11 07:04:55
问题 here is part of my theano code for dl4mt (neural machine translation) with line number. The src_positions is a vector of int64, which I printed the result, with the value no more than 16. but when I use src_positions to index attention_mask_, of which the shape is (100, 100). it got index out of bound error. Here comes the weird part: firstly, the attention_mask_ and gaussian_mask_ are of the same shape. when I use 0.1 * src_positions to index (replace line 5 with commented line 4). line 8

Defining grad of a custom Op theano

杀马特。学长 韩版系。学妹 提交于 2019-12-11 06:50:11
问题 I am trying to define a custom theano Op with a gradient to use it with pymc3 but I don't understand how to define the grad method. The code below is where I'm stuck. The function phi() is a mock function (in practice, it is an external program); for a scalar input x it returns a vector (phi_0(x), phi_1(x), ...) . The function phi_diff() (also a mock function) returns the vector (dphi_0/dx, dphi_1/dx, ...) . I wrapped phi() and phi_diff() in a theano.Op object but my implementation of the

Theano 'Expected an array-like object, but found a Variable': Using scan & categorical_crossentropy

北城以北 提交于 2019-12-11 06:37:30
问题 I'm trying to sum multiple loss in theano but I can't make it work. I'm using the categorical crossentroy. Here is my code: import numpy as np import theano import theano.tensor as T answers = T.ivector() temp = T.scalar() predictions = T.matrix() def loss_acc(curr_ans,curr_pred, loss): temp= T.nnet.categorical_crossentropy(curr_pred.dimshuffle('x',0), T.stack([curr_ans]))[0] return temp + loss outputs, updates = theano.scan(fn = loss_acc, sequences = [answers, predictions], outputs_info =

Keras custom metric gives incorrect tensor shape

浪子不回头ぞ 提交于 2019-12-11 06:11:41
问题 I want to monitor the dimension of y_pred by defining my own custom metric (using the Theano backend) def shape_test(y_true, y_pred): return K.shape(y_pred)[0] I was assuming that the dimension of y_pred in the custom metric function is equal to the mini batch size. However, I get weird output. See a small reproducible example below. #imports and definitions import numpy numpy.random.seed(1234) import keras.backend as K from keras.models import Sequential from keras.layers import Dense from

Error loading library gpuarray with Theano

不打扰是莪最后的温柔 提交于 2019-12-11 05:18:18
问题 I am trying to run this script to test Theano's use of my GPU and get the following error: ERROR (theano.gpuarray): Could not initialize pygpu, support disabled Traceback (most recent call last): File "/home/me/anaconda3/envs/py35/lib/python3.5/site- packages/theano/gpuarray/__init__.py", line 164, in <module> use(config.device) File "/home/me/anaconda3/envs/py35/lib/python3.5/site- packages/theano/gpuarray/__init__.py", line 151, in use init_dev(device) File "/home/me/anaconda3/envs/py35/lib