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
14
votes
2 answers

sklearn: How to reset a Regressor or classifier object in sknn

I have defined a regressor as follows: nn1 = Regressor( layers=[ Layer("Rectifier", units=150), Layer("Rectifier", units=100), Layer("Linear")], regularize="L2", #…
RawMean
  • 8,374
  • 6
  • 55
  • 82
14
votes
2 answers

Python theano with index computed inside the loop

I have installed the Theano library for increasing the speed of a computation, so that I can use the power of a GPU. However, inside the inner loop of the computation a new index is calculated, based on the loop index and corresponding values of a…
Alex van Houten
  • 308
  • 3
  • 17
13
votes
1 answer

Share weights between two dense layers in keras

I have a code as follows. What I want to do is to share the same weights in two dense layers. The equation for op1 and op2 layer will be like that op1 = w1y1 + w2y2 + w3y3 + w4y4 + w5y5 + b1 op2 = w1z1 + w2z2 + w3z3 + w4z4 + w5z5 + b1 here w1 to w5…
Mahek Shah
  • 485
  • 2
  • 5
  • 17
13
votes
1 answer

keras ignoring values in $HOME/.keras/keras.json file

I know the default backend for Keras has switched from Theano to TensorFlow, but with the dev version of Theano I can train on the GPU with OpenCL (I have an AMD card). However, when I import Keras, it only uses the TensorFlow backend even after I…
themantalope
  • 1,040
  • 11
  • 42
13
votes
3 answers

How to apply outer product for tensors without unnecessary increase of dimensions?

I have two vectors v and w and I want to make a matrix m out of them such that: m[i, j] = v[i] * w[j] In other words I want to calculate the outer product of them. I can do it either by using theano.tensor.outer or by adding new indexes to v and v…
Roman
  • 124,451
  • 167
  • 349
  • 456
13
votes
4 answers

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

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…
Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
13
votes
2 answers

tensorflow store training data on GPU memory

I am pretty new to tensorflow. I used to use theano for deep learning development. I notice a difference between these two, that is where input data can be stored. In Theano, it supports shared variable to store input data on GPU memory to reduce…
xyd
  • 509
  • 1
  • 7
  • 17
13
votes
1 answer

Theano config directly in script

I'm new to Theano and I wonder how to configure the default setting directly from script (without setting envir. variables). E.g. this is a working solution (source): $ THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python check1.py I intend…
petrbel
  • 2,428
  • 5
  • 29
  • 49
13
votes
1 answer

How to get value from a theano tensor variable backed by a shared variable?

I have a theano tensor variable created from casting a shared variable. How can I extract the original or casted values? (I need that so I don't have to carry the original shared/numpy values around.) >>> x = theano.shared(numpy.asarray([1, 2, 3],…
teddy
  • 2,158
  • 4
  • 26
  • 34
13
votes
4 answers

Theano fails due to NumPy Fortran mixup under Ubuntu

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 +…
Framester
  • 33,341
  • 51
  • 130
  • 192
12
votes
3 answers

module 'numpy.distutils.__config__' has no attribute 'blas_opt_info'

I'm trying to study the neural-network-and-deep-learning (http://neuralnetworksanddeeplearning.com/chap1.html). Using the updated version for Python 3 by MichalDanielDobrzanski (https://github.com/MichalDanielDobrzanski/DeepLearningPython). Tried to…
Turq6ise
  • 123
  • 1
  • 1
  • 6
12
votes
4 answers

Import theano gives the AttributeError: module 'theano' has no attribute 'gof'

I have python 3. I installed "Theano" bleeding edge and "Keras" using pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git and also pip install --upgrade git+git://github.com/Theano/Theano.git and pip install…
uncommon_name
  • 470
  • 2
  • 5
  • 19
12
votes
2 answers

Training only one output of a network in Keras

I have a network in Keras with many outputs, however, my training data only provides information for a single output at a time. At the moment my method for training has been to run a prediction on the input in question, change the value of the…
12
votes
3 answers

Keras import error Nadam

I am getting an import error when trying to import the Keras module Nadam: >>> from keras.optimizers import Nadam Traceback (most recent call last): File "", line 1, in ImportError: cannot import name Nadam I can import and use…
Chris Parry
  • 2,937
  • 7
  • 30
  • 71
12
votes
0 answers

How to run several Keras neural networks in parallel

I'm trying to use Keras to run a reinforcement learning algorithm. In this algorithm, I'm training a neural network. What's different from other learning problems is that I need to use the neural network itself to generate training data, and repeat…
LouYu
  • 671
  • 1
  • 6
  • 14