theano

Defining a gradient with respect to a subtensor in Theano

被刻印的时光 ゝ 提交于 2019-12-01 03:26:53
I have what is conceptually a simple question about Theano but I haven't been able to find the answer (I'll confess upfront to not really understanding how shared variables work in Theano, despite many hours with the tutorials). I'm trying to implement a "deconvolutional network"; specifically I have a 3-tensor of inputs (each input is a 2D image) and a 4-tensor of codes; for the ith input codes[i] represents a set of codewords which together code for input i. I've been having a lot of trouble figuring out how to do gradient descent on the codewords. Here are the relevant parts of my code: idx

getting “pygpu was configured but could not be imported” error while trying with OpenCL+Theano on AMD Radeon

寵の児 提交于 2019-12-01 00:04:09
问题 I have followed the instructions from this: https://gist.github.com/jarutis/ff28bca8cfb9ce0c8b1a But then when I tried : THEANO_FLAGS=device=opencl0:0 python test.py on the test file I am getting error: ERROR (theano.sandbox.gpuarray): pygpu was configured but could not be imported Traceback (most recent call last): File "/home/mesayantan/.local/lib/python2.7/site-packages/theano/sandbox/gpuarray/ init .py", line 20, in import pygpu File "/usr/src/gtest/clBLAS/build/libgpuarray/pygpu/ init

Keras: What if the size of data is not divisible by batch_size?

戏子无情 提交于 2019-11-30 23:55:04
问题 I am new to Keras and just started working on some examples. I am dealing with the following problem: I have 4032 samples and use about 650 of them as for the fit or basically the training state and then use the rest for testing the model. The problem is that I keep getting the following error: Exception: In a stateful network, you should only pass inputs with a number of samples that can be divided by the batch size. I understand why I am getting this error, my question is, what if the size

Use of None in Array indexing in Python

我只是一个虾纸丫 提交于 2019-11-30 21:55:43
问题 I am using the LSTM tutorial for Theano (http://deeplearning.net/tutorial/lstm.html). In the lstm.py (http://deeplearning.net/tutorial/code/lstm.py) file, I don't understand the following line: c = m_[:, None] * c + (1. - m_)[:, None] * c_ What does m_[:, None] mean? In this case m_ is the theano vector while c is a matrix. 回答1: This question has been asked and answered on the Theano mailing list, but is actually about the basics of numpy indexing. Here are the question and answer https:/

Reusing compiled Theano functions

☆樱花仙子☆ 提交于 2019-11-30 19:09:52
Suppose I have implemented the following function in Theano: import theano.tensor as T from theano import function x = T.dscalar('x') y = T.dscalar('y') z = x + y f = function([x, y], z) When I try to run it a graph of computations is constructed, the function gets optimized and compiled. How can I reuse this compiled chunk of code from within a Python script and/or a C++ application? EDIT: The goal is to construct a deep learning network and reuse it in a final C++ app. nouiz Currently this isn't possible. There is user that modified Theano to allow pickling the Theano function, but during

How to install Theano on Ubuntu 14.04 x64, and configure it so that it uses the GPU?

谁说我不能喝 提交于 2019-11-30 18:31:56
问题 I tried to follow the instructions on Easy Installation of an Optimized Theano on Current Ubuntu but it doesn't work: whenever I run a Theano script using GPU, it gives me the error message: CUDA is installed, but device gpu is not available (error: Unable to get the number of gpus available: no CUDA-capable device is detected) More specifically, following the instructions in the linked webpage, I executed the following steps: # Install Theano sudo apt-get install python-numpy python-scipy

Accessing gradient values of keras model outputs with respect to inputs

一世执手 提交于 2019-11-30 15:40:33
I made a pretty simple NN model to do some non-linear regressions for me in Keras, as an introduction exercise. I uploaded my jupyter notebookit as a gist here (renders properly on github), which is pretty short and to the point. It just fits the 1D function y = (x - 5)^2 / 25. I know that Theano and Tensorflow are, at their core, graph based derivative (gradient) passing frameworks. And utilizing the gradients of loss functions with respect to weights for gradient step-based optimization are the main purpose of that. But what I'm trying to get sense of is if I have access to something that,

Importing theano: AttributeError: 'module' object has no attribute 'find_graphviz'

北城余情 提交于 2019-11-30 12:10:37
问题 When I run import theano in Python, I get the following error message: Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import theano Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 74, in <module> from theano.printing import pprint, pp File "/usr/local/lib/python2.7/dist-packages/theano/printing.py", line

Theano fails due to NumPy Fortran mixup under Ubuntu

限于喜欢 提交于 2019-11-30 12:08:10
I installed Theano on my machine, but the nosetests break with a Numpy/Fortran related error message. For me it looks like Numpy was compiled with a different Fortran version than Theano. I already reinstalled Theano ( sudo pip uninstall theano + sudo pip install --upgrade --no-deps theano ) and Numpy / Scipy ( apt-get install --reinstall python-numpy python-scipy ), but this did not help. What steps would you recommend? Complete error message: ImportError: ('/home/Nick/.theano/compiledir_Linux-2.6.35-31-generic-x86_64-with-Ubuntu-10.10-maverick--2.6.6/tmpIhWJaI

Install Cuda without root

廉价感情. 提交于 2019-11-30 10:50:41
问题 I know that I can install Cuda with the following: wget http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run chmod +x cuda_7.0.28_linux.run ./cuda_7.0.28_linux.run -extract=`pwd`/nvidia_installers cd nvidia_installers sudo ./NVIDIA-Linux-x86_64-346.46.run sudo modprobe nvidia sudo ./cuda-linux64-rel-7.0.28-19326674.run Just wondering if I can install Cuda without root? Thanks, 回答1: You can install CUDA and compile programs, but you won't be able to