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.

2444 questions
101
votes
9 answers

Deep-Learning Nan loss reasons

Perhaps too general a question, but can anyone explain what would cause a Convolutional Neural Network to diverge? Specifics: I am using Tensorflow's iris_training model with some of my own data and keep getting ERROR:tensorflow:Model diverged with…
Free Url
  • 1,336
  • 2
  • 12
  • 24
95
votes
6 answers

Keras, how do I predict after I trained a model?

I'm playing with the reuters-example dataset and it runs fine (my model is trained). I read about how to save a model, so I could load it later to use again. But how do I use this saved model to predict a new text? Do I use models.predict()? Do I…
ben
  • 1,133
  • 2
  • 9
  • 10
91
votes
21 answers

NaN loss when training regression network

I have a data matrix in "one-hot encoding" (all ones and zeros) with 260,000 rows and 35 columns. I am using Keras to train a simple neural network to predict a continuous variable. The code to make the network is the following: model =…
The_Anomaly
  • 1,893
  • 2
  • 15
  • 20
85
votes
11 answers

How to get reproducible results in keras

I get different results (test accuracy) every time I run the imdb_lstm.py example from Keras framework (https://github.com/fchollet/keras/blob/master/examples/imdb_lstm.py) The code contains np.random.seed(1337) in the top, before any keras imports.…
Pavel Surmenok
  • 4,064
  • 3
  • 27
  • 33
65
votes
5 answers

How to add and remove new layers in keras after loading weights?

I am trying to do a transfer learning; for that purpose I want to remove the last two layers of the neural network and add another two layers. This is an example code which also output the same error. from keras.models import Sequential from…
Eka
  • 10,884
  • 31
  • 98
  • 166
64
votes
8 answers

How do I install Keras and Theano in Anaconda Python on Windows?

I am trying to work on neural networks in Python using the following Keras packages: from keras.utils import np_utils from keras.layers.core import Dense, Activation, Dropout from keras.models import Sequential from keras.layers.core import Dense,…
pavikirthi
  • 1,461
  • 3
  • 13
  • 21
63
votes
6 answers

Keras model.summary() result - Understanding the # of Parameters

I have a simple NN model for detecting hand-written digits from a 28x28px image written in python using Keras (Theano backend): model0 = Sequential() #number of epochs to train for nb_epoch = 12 #amount of data each iteration in an epoch…
user3501476
  • 935
  • 1
  • 11
  • 23
61
votes
8 answers

How to compute Receiving Operating Characteristic (ROC) and AUC in keras?

I have a multi output(200) binary classification model which I wrote in keras. In this model I want to add additional metrics such as ROC and AUC but to my knowledge keras dosen't have in-built ROC and AUC metric functions. I tried to import ROC,…
Eka
  • 10,884
  • 31
  • 98
  • 166
59
votes
7 answers

Convert Keras model to C++

I am using Keras (with Theano) to train my CNN model. Does anyone has idea how can I use it in my C++ application? Does anyone tried something similar? I have idea to write some python code that will generate a c++ code with network functions - any…
pplonski
  • 2,996
  • 1
  • 15
  • 20
55
votes
8 answers

How to switch Backend with Keras (from TensorFlow to Theano)

I tried to switch Backend with Keras (from TensorFlow to Theano) but did not manage. I followed the temps described here but it doesn't work. I created a keras.json in the keras' directory (as it did not exist) but it doesn't change anything when I…
DaniPaniz
  • 988
  • 2
  • 10
  • 18
51
votes
13 answers

Keras accuracy does not change

I have a few thousand audio files and I want to classify them using Keras and Theano. So far, I generated a 28x28 spectrograms (bigger is probably better, but I am just trying to get the algorithm work at this point) of each audio file and read the…
Murat Aykanat
  • 1,328
  • 4
  • 24
  • 31
49
votes
3 answers

What is the number of filter in CNN?

I am currently seeing the API of theano, theano.tensor.nnet.conv2d(input, filters, input_shape=None, filter_shape=None, border_mode='valid', subsample=(1, 1), filter_flip=True, image_shape=None, **kwargs) where the filter_shape is a tuple of…
xxx222
  • 2,175
  • 4
  • 24
  • 43
44
votes
2 answers

Getting gradient of model output w.r.t weights using Keras

I am interested in building reinforcement learning models with the simplicity of the Keras API. Unfortunately, I am unable to extract the gradient of the output (not error) with respect to the weights. I found the following code that performs a…
Matt S
  • 1,276
  • 1
  • 13
  • 16
40
votes
5 answers

What is the correct way to change image channel ordering between channels first and channels last?

I can not for the life of me figure out how to switch the image ordering. images are read in (x,x,3) format, theano requires it to be in (3,x,x) format. I tried changing the order with numpy.array([img[:,:,i] for i in range(3)]) which i guess gets…
Kuysea
  • 400
  • 1
  • 3
  • 8
40
votes
3 answers

Keras uses way too much GPU memory when calling train_on_batch, fit, etc

I've been messing with Keras, and like it so far. There's one big issue I have been having, when working with fairly deep networks: When calling model.train_on_batch, or model.fit etc., Keras allocates significantly more GPU memory than what the…
Martin
  • 401
  • 1
  • 4
  • 6
1
2 3
99 100