Questions tagged [theano]

Theano is a numerical computation library for Python. Computations are expressed using a Numpy-like syntax and compiled to run efficiently on either CPU or GPU architectures. Theano uses a mathematical computational graph and optimized the graph to speed up the computations using optimized C code. As of release 1.0, Theano will no longer be actively developed.

Theano is a Python library for performing tensor calculations with a -like syntax. Theano can be used to define, optimize, and evaluate mathematical expressions involving tensors (also see ). Some of the principal features of Theano that set it apart from other libraries have become commonplace in neural network and tensor math libraries:

  • Integrates with Numpy and provides Numpy-like syntax to express models using mathematical syntax
  • Represents calculations as computation graphs and optimizes graphs for better performance and memory utilization
  • Utilizes GPU hardware for data-intensive calculations
  • Performs high-order differentiation automatically (symbolically)
  • Compiles computation graphs into C code for faster execution

Theano enables rapid building of large-scale computational codes with less cognitive overhead and more expressive syntax. However, it is easy enough to learn that it is used in several deep learning courses (including at the University of Montreal, where it was originally developed).

Several projects build on top of Theano, including and .

As of Theano 1.0, Theano will no longer be under active development. See announcement on mailing list.

Resources

Trivia

Theano is named after a high priestess of Athena in the city of Troy, from Homer's Iliad.

2447 questions
10
votes
1 answer

The update order of theano function's update list

Theano function's parameter updates take a list of pair, in which each pair specifys a shared symbolic variable and its new expression after the calculating the function outputs. I wonder whether there is any order for the updating procedure. The…
itsuper7
  • 735
  • 1
  • 6
  • 12
10
votes
1 answer

Python - Theano scan() function

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=…
Nfys
  • 804
  • 1
  • 13
  • 30
10
votes
1 answer

Theano broadcasting different to numpy's

Consider the following example of numpy broadcasting: import numpy as np import theano from theano import tensor as T xval = np.array([[1, 2, 3], [4, 5, 6]]) bval = np.array([[10, 20, 30]]) print xval + bval As expected, the vector bval is added…
mbatchkarov
  • 15,487
  • 9
  • 60
  • 79
9
votes
1 answer

Correctly loading Keras model in Django that supports multi-tenancy

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…
Sourav Kanta
  • 2,727
  • 1
  • 18
  • 29
9
votes
3 answers

Python/Keras/Theano wrong dimensions for Deep Autoencoder

I'm trying to follow the Deep Autoencoder Keras example. I'm getting a dimension mismatch exception, but for the life of me, I can't figure out why. It works when I use only one encoded dimension, but not when I stack them. Exception: Input 0…
Chris
  • 676
  • 5
  • 20
9
votes
3 answers

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

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…
kwotsin
  • 2,882
  • 9
  • 35
  • 62
9
votes
1 answer

Theano: Initialisation of device gpu failed! Reason=CNMEM_STATUS_OUT_OF_MEMORY

I am running the example kaggle_otto_nn.py of Keras with backend of theano. When I set cnmem=1, the following error comes out: cliu@cliu-ubuntu:keras-examples$ THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32,lib.cnmem=1 python…
fluency03
  • 2,637
  • 7
  • 32
  • 62
9
votes
1 answer

Can I (selectively) invert Theano gradients during backpropagation?

I'm keen to make use of the architecture proposed in the recent paper "Unsupervised Domain Adaptation by Backpropagation" in the Lasagne/Theano framework. The thing about this paper that makes it a bit unusual is that it incorporates a 'gradient…
Bill Cheatham
  • 11,396
  • 17
  • 69
  • 104
9
votes
2 answers

Theano import error: No module named cPickle

>>> import theano Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.7/site-packages/theano/__init__.py", line 52, in from theano.gof import ( File…
9
votes
4 answers

Error importing theano "cannot import name gof"

I am current getting the error ImportError: cannot import name gof when importing theano. >>> import theano Traceback (most recent call last): File "", line 1, in import theano File…
Huynh Vu
  • 91
  • 1
  • 1
  • 3
9
votes
2 answers

compilation failure when running theano - windows 8.1 64 bit with Anaconda python distribution

I am running lasagne/nolearn, which uses theano. It has been particularly difficult to install and compile theano. The following compilation error happens after installing a 64 bit g++ compiler. Help is much appreciated. Thanks! Problem occurred…
Alejandro Simkievich
  • 3,512
  • 4
  • 33
  • 49
9
votes
1 answer

Out of memory when creating a Theano shared variable with borrow=True

I'm trying to allocate a really big dataset (~28GB of RAM in an ndarray) into theano shared variables, using borrow=True to avoid replicating the memory. In order to do so, I'm using the following function: def load_dataset(path): # Load dataset…
gaspercat
  • 425
  • 5
  • 13
9
votes
1 answer

import theano gets Illegal instruction

after install the bleeding-edge version and even uninstall Theano, I'm still getting "Illegal instruction" from "import theano", i'm on ubuntu 12.04 precise zhge@phx-r-ins1-7773:~$ sudo pip uninstall Theano Uninstalling Theano: Proceed (y/n)? y …
neghez
  • 715
  • 1
  • 8
  • 15
9
votes
1 answer

Defining a gradient with respect to a subtensor in Theano

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…
jdbrody
  • 533
  • 7
  • 16
8
votes
2 answers

numpy AttributeError: with theano module 'numpy.core.multiarray' has no attribute _get_ndarray_c_version

I'm running this simple example: import theano x = theano.tensor.dscalar() f = theano.function([x], 2*x) f(4) and I get: AttributeError: ('The following error happened while compiling the node', Elemwise{mul,no_inplace}(TensorConstant{2.0},…
Makis Kans
  • 337
  • 3
  • 12