theano

Python theano undefined symbol: _ZdlPvm error

♀尐吖头ヾ 提交于 2019-12-23 15:24:57
问题 I'm trying to execute this code: import matplotlib.pyplot as plt import numpy as np from keras.models import Sequential from keras.layers import Dense x = np.linspace(-3, 3, 1000).reshape(-1, 1) def f(x): return 2 * x + 5 f = np.vectorize(f) y = f(x) def baseline_model(): model = Sequential() model.add(Dense(1, input_dim=1, activation='linear')) model.compile(loss='mean_squared_error', optimizer='sgd') return model model = baseline_model() model.fit(x, y, nb_epoch=100, verbose = 0) But on

Getting Theano to use the GPU

梦想的初衷 提交于 2019-12-23 09:00:16
问题 I am having quite a bit of trouble setting up Theano to work with my graphics card - I hope you guys can give me a hand. I have used CUDA before and it is properly installed as would be necessary to run Nvidia Nsight. However, I now want to use it with PyDev and am having several problems following the 'Using the GPU' part of the tutorial at http://deeplearning.net/software/theano/install.html#gpu-linux The first is quite basic, and that is how to set up the environment variables. It says I

What pymc3 Monte-Carlo stepper can I use for a custom categorical distribution?

穿精又带淫゛_ 提交于 2019-12-23 04:53:25
问题 I am working on implementing hidden-Markov-Chains in pymc3. I have gotten pretty far in implementing the hidden states. Below, I am showing a simple 2-state Markov-chain: import numpy as np import pymc3 as pm import theano.tensor as tt # Markov chain sample with 2 states that was created # to have prob 0->1 = 0.1 and prob 1->0 = 0.3 sample = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,

IPython module import error: /usr/bin/ld: cannot find -lpython2.7. collect2: ld returned 1 exit status

对着背影说爱祢 提交于 2019-12-23 04:07:12
问题 I'm using the Python module Theano on a server. It is not pre-installed on there so I installed it in my home folder along with some other modules that weren't on the server. I get the following error when I "import theano" in IPython. Problem occurred during compilation with the command line below: g++ -shared -g -march=core2 -mcx16 -msahf -maes -mpclmul -mpopcnt -msse4.2 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=12288 -mtune=generic -D NPY_NO_DEPRECATED

Theano with Anaconda on Windows: how to setup BLAS?

◇◆丶佛笑我妖孽 提交于 2019-12-23 03:01:30
问题 I've used Anaconda to install Theano (and Keras) on Windows 7 64bit. Here are my steps. Install the latest Anaconda for Python 3.5 conda install mingw libpython pip install Theano conda install pydot-ng pip install keras Edit .keras/keras.json to use "theano" instead of "tensorflow". Open Jupyter, copy and paste this code: https://github.com/fchollet/keras/blob/master/examples/cifar10_cnn.py It executes fine until the call to model.fit : imports, data download, model compilation all work.

Theano with Anaconda on Windows: how to setup BLAS?

爱⌒轻易说出口 提交于 2019-12-23 03:01:13
问题 I've used Anaconda to install Theano (and Keras) on Windows 7 64bit. Here are my steps. Install the latest Anaconda for Python 3.5 conda install mingw libpython pip install Theano conda install pydot-ng pip install keras Edit .keras/keras.json to use "theano" instead of "tensorflow". Open Jupyter, copy and paste this code: https://github.com/fchollet/keras/blob/master/examples/cifar10_cnn.py It executes fine until the call to model.fit : imports, data download, model compilation all work.

Passing Individual Channels of Tensors to Layers in Keras

烂漫一生 提交于 2019-12-23 02:18:33
问题 I am trying to emulate something equivalent to a SeparableConvolution2D layer for the theano backend (it already exists for the TensorFlow backend). As the first step What I need to do is pass ONE channel from a tensor into the next layer. So say I have a 2D convolution layer called conv1 with 16 filters which produces an output with shape: (batch_size, 16, height, width) I need to select the subtensor with shape (: , 0, : , : ) and pass it to the next layer. Simple enough right? This is my

Ubuntu19 安装 pylearn2

自古美人都是妖i 提交于 2019-12-23 00:39:09
环境: head -n 1 /etc/issue # Ubuntu 19.10 \n \l python -V # Python 2.7.17 其中,python环境是我自己建立的虚拟 venv 方便测试( 相当于你的python 实际路径) 目录结构: 以下出现的目录都是相对于次工程的根目录 your_program_path/data/cifar10 2. 安装 2.1安装 theano, 依赖的环境: g++,numpy,scipy: pip install Theano 或者 cd Theano python setup.py build python setup.py install 注意: ubuntu 自带 g++ , 你可以运行 test g++ 没有输出则正常. 如果你是 windows 系统,可以下载MinGW安装g++ , 然后用 test g++ 来检验 2.2安装 pylearn2: cd pylearn2 python setup.py build python setup.py install 这时会报错: No module named ‘theano.compat.six’ 可以参考: Ubuntu19 安装Theano出现“No module named ‘theano.compat.six’” 修改 pylearn2/setup.py 第8行:

Theano tensor slicing… how to use boolean to slice?

假装没事ソ 提交于 2019-12-22 10:14:36
问题 In numpy, if I have a boolean array, I can use it to select elements of another array: >>> import numpy as np >>> x = np.array([1, 2, 3]) >>> idx = np.array([True, False, True]) >>> x[idx] array([1, 3]) I need to do this in theano. This is what I tried, but I got an unexpected result. >>> from theano import tensor as T >>> x = T.vector() >>> idx = T.ivector() >>> y = x[idx] >>> y.eval({x: np.array([1,2,3]), idx: np.array([True, False, True])}) array([ 2., 1., 2.]) Can someone explain the

print out the shape of each layer in the net architecture

亡梦爱人 提交于 2019-12-22 09:06:19
问题 In Keras, we can define the network as follows. Are there any way to output the shape after each layer. For instance, I want to print out the shape of inputs after the line defining inputs , then print out the shape of conv1 after the line defining conv1 , etc. inputs = Input((1, img_rows, img_cols)) conv1 = Convolution2D(64, 3, 3, activation='relu', init='lecun_uniform', W_constraint=maxnorm(3), border_mode='same')(inputs) conv1 = Convolution2D(64, 3, 3, activation='relu', init='lecun