theano

nvcc fatal : Cannot find compiler 'cl.exe' in PATH although Visual Studio 12.0 is added to PATH

末鹿安然 提交于 2019-12-05 05:37:24
I have followed all the instructions from https://datanoord.com/2016/02/01/setup-a-deep-learning-environment-on-windows-theano-keras-with-gpu-enabled/ but can't seem to get it work. I have added C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin to my PATH variable Every time I run the code from the Theano website to test whether a CPU or GPU is used, it gives me a fatal error of "nvcc fatal : Cannot find compiler 'cl.exe' in PATH" Here is the code I use to test: from theano import function, config, shared, sandbox import theano.tensor as T import numpy import time vlen = 10 * 30 * 768

Theano Import error

我的梦境 提交于 2019-12-05 05:24:05
I am trying to install Theano on CPU machine (running intel HD graphics, without NVIDIA). I get the following import error while testing in python. WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to exe cute optimized C-implementations (for both CPU and GPU) and will default to Pyth on implementations. Performance will be severely degraded. To remove this warnin g, set Theano flags cxx to an empty string. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\anaconda\pkgs\theano\theano\__init__.py", line 74, in <module> from theano.printing

How Can I use my GPU on Ipython Notebook?

南笙酒味 提交于 2019-12-05 05:21:56
OS : Ubuntu 14.04LTS Language : Python Anaconda 2.7 (keras, theano) GPU : GTX980Ti CUDA : CUDA 7.5 I wanna run keras python code on IPython Notebook by using my GPU(GTX980Ti) But I can't find it. I want to test below code. When I run it on to Ubuntu terminal, I command as below (It uses GPU well. It doesn't have any problem) First I set the path like below export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH Second I run the code as below THEANO_FLAGS='floatX=float32,device=gpu0,nvcc.fastmath=True' python myscript.py And it runs well. But when i

Python - Theano scan() function

♀尐吖头ヾ 提交于 2019-12-05 02:32:08
I cannot fully understand the behaviour of theano.scan(). Here's an example: import numpy as np import theano import theano.tensor as T def addf(a1,a2): return a1+a2 i = T.iscalar('i') x0 = T.ivector('x0') step= T.iscalar('step') results, updates = theano.scan(fn=addf, outputs_info=[{'initial':x0, 'taps':[-2]}], non_sequences=step, n_steps=i) f=theano.function([x0,i,step],results) print f([1,1],10,2) The above snippet prints the following sequence, which is perfectly reasonable: [ 3 3 5 5 7 7 9 9 11 11] However if I switch the tap index from -2 to -1, i.e. outputs_info=[{'initial':x0, 'taps':[

Keras: convert pretrained weights between theano and tensorflow

不打扰是莪最后的温柔 提交于 2019-12-05 01:14:32
I would like to use this pretrained model . It is in theano layout, my code depends on tensorflow image dimension ordering. There is a guide on converting weights between the formats . But this seems broken. In the section to convert theano to tensorflow, the first instruction is to load the weights into the tensorflow model. Keras backend should be TensorFlow in this case. First, load the Theano-trained weights into your TensorFlow model: model.load_weights('my_weights_theano.h5') This raises an exception, the weight layouts would be incompatible. And if the load_weights function would take

Theano HiddenLayer Activation Function

我的未来我决定 提交于 2019-12-05 00:46:05
Is there anyway to use Rectified Linear Unit (ReLU) as the activation function of the hidden layer instead of tanh() or sigmoid() in Theano? The implementation of the hidden layer is as follows and as far as I have searched on the internet ReLU is not implemented inside the Theano. class HiddenLayer(object): def __init__(self, rng, input, n_in, n_out, W=None, b=None, activation=T.tanh): pass relu is easy to do in Theano: switch(x<0, 0, x) To use it in your case make a python function that will implement relu and pass it to activation: def relu(x): return theano.tensor.switch(x<0, 0, x)

Correctly loading Keras model in Django that supports multi-tenancy

荒凉一梦 提交于 2019-12-04 23:30:03
问题 I am try to write a REST api in django that uses a Keras model to return a prediction. However the load_model() function takes some time to load the model and I don't want my users to have to wait so long (each time the model is initialized). What would be the correct way to initialize the model so that is is loaded once and the predictions are done using that same model? On a side note one method that I thought cold be possible was to initialize the model in settings.py as below : settings

Using the TimeSeriesNnet() method from the nnet_ts module throws NameError

假装没事ソ 提交于 2019-12-04 19:24:21
I am trying to create a neural network using the python module nnet-ts. It has a built-in method named TimeSeriesNnet(), which takes two arguments; hidden_layers and activation_functions. See documentation for this module, as well as example in the README.md: https://github.com/hawk31/nnet-ts I am running python version 2.7.13 The nnet-ts module has dependencies to 5 particular packages, which I am listing below together with the current versions I am using: numpy-1.13.0, pandas-0.20.2, scipy-0.19.0, theano-0.9.0 and keras-2.0.5 Following the example in the README (link above), my code reads

using multiprocessing with theano

≡放荡痞女 提交于 2019-12-04 14:12:53
I'm trying to use theano with cpu-multiprocessing with a neural network library, Keras. I use device=gpu flag and load the keras model. Then for extracting features for over a million images, im using multiprocessing pool. The function looks something like this: from keras import backend as K f = K.function([model.layers[0].input, K.learning_phase()], [model.layers[-3].output,]) def feature_gen(flz): im = imread(flz) cPickle.dump(f([im, 0])[0][0], open(flz, 'wb'), -1) pool = mp.Pool(processes=10) results = [pool.apply_async(feature_gen, args=(f, )) for f in filelist]] This however starts

ImportError: No module named downsample

随声附和 提交于 2019-12-04 12:53:14
问题 I am using Theano. The OS is Ubuntu. The Theano is UPTODATE. I am wondering why I am getting by from theano.tensor.signal.downsample import max_pool_2d command. ImportError: No module named downsample . 回答1: The downsample module has been moved to pool , so try declaring it as: from theano.tensor.signal.pool import pool_2d After changing delete your theano cache with the command: theano-cache purge 回答2: update theano and lasagne pip install --upgrade https://github.com/Theano/Theano/archive