History & Origin of Theano
Theano’s husband, Pythagoras (c. 582500 B.C.), was inspired one of the most influential sects in the ancient world. Best known for devising the Pythagorean Theorem—which states that the sum of the squares of the sides of a right triangle is equal to the square of the hypotenuse—Pythagoras was considered the greatest scientist of antiquity by classical Greek scholars and is considered to have been the first mathematician. However, given that Pythagoras lived seven generations before Plato, most of the information about him comes from fairly late sources—a few as late as the third century A.D. Another problem is that some of these sources are of doubtful reliability. However, references to Pythagoras’s ideas can be found in earlier writings, including those of Empedocles, Heraclitus, Herodotus, Plato, and Aristotle.
What is Theano
Theano is a Python library that allows us to evaluate mathematical operations including multidimensional arrays so efficiently. It is mostly used in building Deep Learning Projects. It works a way more faster on Graphics Processing Unit (GPU) rather than on CPU. Theano attains high speeds that gives a tough competition to C implementations for problems involving large amounts of data. It can take advantage of GPUs which makes it perform better than C on a CPU by considerable orders of magnitude under some certain circumstances.
It knows how to take structures and convert them into very efficient code that uses numpy and some native libraries. It is mainly designed to handle the types of computation required for large neural network algorithms used in Deep Learning. That is why, it is a very popular library in the field of Deep Learning.
How to install Theano :
pip install theano
Several of the symbols we will need to use are in the tensor subpackage of Theano. We often import such packages with a handy name, let’s say, T.
from theano import * import theano.tensor as T
Why Theano Python Library :
Theano is a sort of hybrid between numpy and sympy, an attempt is made to combine the two into one powerful library. Some advantages of theano are as follows:
 Stability Optimization: Theano can find out some unstable expressions and can use more stable means to evaluate them
 Execution Speed Optimization: As mentioned earlier, theano can make use of recent GPUs and execute parts of expressions in your CPU or GPU, making it much faster than Python
 Symbolic Differentiation: Theano is smart enough to automatically create symbolic graphs for computing gradients
Basics of Theano :
Theano is a Python library that allows you to define, optimize, and evaluate mathematical expressions involving multidimensional arrays efficiently.Some Theano implementations are as follows.
Subtracting two scalars :
 Python
# Python program showing # subtraction of two scalars import theano from theano import tensor # Declaring variables a = tensor.dscalar() b = tensor.dscalar() # Subtracting res = a  b # Converting it to a callable object # so that it takes matrix as parameters func = theano.function([a, b], res) # Calling function assert 20.0 = = func( 30.5 , 10.5 ) 
It will not provide any output as the assertion of two numbers matches the number given, hence it results into a true value.
Adding two scalars :
 Python
# Python program showing # addition of two scalars # Addition of two scalars import numpy import theano.tensor as T from theano import function # Declaring two variables x = T.dscalar( 'x' ) y = T.dscalar( 'y' ) # Summing up the two numbers z = x + y # Converting it to a callable object # so that it takes matrix as parameters f = function([x, y], z) f( 5 , 7 ) 
Output: array(12.0)
How Theano works aka Theano architecture?
Theano itself is effectively dead, but the deep learning frameworks built on top of Theano, are still functioning. These include the more userfriendly frameworks Keras, Lasagne, and Blocks. These three provide highlevel frameworks for fast prototyping and model testing.
 Step 0: Import libraries. import numpy as np import theano.tensor as T from theano import function. …
 Step 1: Define variables. a = T.dscalar(‘a’) b = T.dscalar(‘b’) …
 Step 2: Define expression. c = a*b f = function([a,b],c) …
 Step 3: Evaluate Expression. f(1.5,3)
Use case of Theano
How to Install Theano
Theano provides extensive installation instructions for the major operating systems: Windows, OS X and Linux. Read the Installing Theano guide for your platform.
Theano assumes a working Python 2 or Python 3 environment with SciPy. There are ways to make the installation easier, such as using Anaconda to quickly set up Python and SciPy on your machine as well as using Docker images.
With a working Python and SciPy environment, it is relatively straightforward to install Theano. from PyPI using pip, for example:
1

pip install Theano

At the time of writing the last official release of Theano was version 0.8 which was released 21th March 2016.
New releases may be announced and you will want to update to get any bug fixes and efficiency improvements. You can upgrade Theano using pip as follows:
1

sudo pip install –upgrade –nodeps theano

You may want to use the bleeding edge version of Theano checked directly out of Github.
This may be required for some wrapper libraries that make use of bleeding edge API changes. You can install Theano directly from a Github checkout as follows:
1

pip install –upgrade –nodeps git+git://github.com/Theano/Theano.git

You are now ready to run Theano on your CPU, which is just fine for the development of small models.
Large models may run slowly on the CPU. If you have a Nvidia GPU, you may want to look into configuring Theano to use your GPU. Read the Using the GPU guides for Linux or Mac OS X to set up Theano to use the GPU and the Using the GPU guide for how to test whether it is working.
Simple Theano Example
In this section we demonstrate a simple Python script that gives you a flavor of Theano.
It is taken from the Theano at a Glance guide. In this example we define two symbolic floating point variables a and b.
We define an expression that uses these variables (c = a + b).
We then compile this symbolic expression into a function using Theano that we can use later.
Finally, we use our complied expression by plugging in some real values and performing the calculation using efficient compiled Theano code under the covers.
1
2
3
4
5
6
7
8
9
10
11
12

import theano
from theano import tensor
# declare two symbolic floatingpoint scalars
a = tensor.dscalar()
b = tensor.dscalar()
# create a simple expression
c = a + b
# convert the expression into a callable object that takes (a,b)
# values as input and computes a value for c
f = theano.function([a,b], c)
# bind 1.5 to ‘a’, 2.5 to ‘b’, and evaluate ‘c’
assert 4.0 == f(1.5, 2.5)

Running the example does not provide any output. The assertion that 1.5 + 2.5 = 4.0 is true.
This is a useful example as it gives you a flavor for how a symbolic expression can be defined, compiled and used. You can see how this may be scaled up to large vector and matrix operations required for deep learning.
Extensions and Wrappers for Theano
If you are new to deep learning you do not have to use Theano directly.
In fact, you are highly encouraged to use one of many popular Python projects that make Theano a lot easier to use for deep learning.
These projects provide data structures and behaviors in Python, specifically designed to quickly and reliably create deep learning models whilst ensuring that fast and efficient models are created and executed by Theano under the covers.
The amount of Theano syntax exposed by the libraries varies.
 For example the Lasagne library provides convenience classes for creating deep learning model but still expects you to know and make use of Theano syntax. This is good for beginners that know or are willing to learn a little Theano as well.
 Another example is Keras that hides Theano completely and provides a very simple API to work with to create Deep Learning models. It hides Theano so well, that it can in fact run as a wrapper for another popular foundation framework called TensorFlow.
Feature and Advantage of using Theano
ABSTRACT
Theano is a linear algebra compiler that optimizes a user’s symbolicallyspecified mathematical computations to produce efficient lowlevel implementations. In this paper, we present new features and efficiency improvements to Theano, and benchmarks demonstrating Theano’s performance relative to Torch7, a recently introduced machine learning library, and to RNNLM, a C++ library targeted at recurrent neural networks.
Best Alternative of Theano
 scikitlearn.
 Keysight Eggplant Platform.
 machinelearning in Python.
 V7.
 Personalizer.
 Kubeflow.
 Google Cloud TPU.
 Torch.
Free Video Tutorials of Theano
Interview Questions and Answer for Theano
1. Theano is a _______ library.
View Answer
Explanation: Theano is a Python library that allows us to evaluate mathematical operations including multidimensional arrays so efficiently.
2. Theano works a way _______ on Graphics Processing Unit (GPU) rather than on CPU.
View Answer
Explanation: It works a way more faster on Graphics Processing Unit (GPU) rather than on CPU.
3. Which command used to install Theano?
View Answer
Explanation: pip install theano command used to install Theano
4. Which of the following are advantages of theano ?
View Answer
Explanation: All of the above are advantages of theano.
5. Which theano type has 16bit integers?
View Answer
Explanation: 16bit integers : wscalar, wvector, wmatrix, wrow, wcol, wtensor3, wtensor4, wtensor5, wtensor6, wtensor7
6. fmatrix theano type has data type?
View Answer
Explanation: float : fscalar, fvector, fmatrix, frow, fcol, ftensor3, ftensor4, ftensor5, ftensor6, ftensor7
7. Theano function acts like a hook for interacting with the symbolic graph.
View Answer
Explanation: True, Theano function acts like a hook for interacting with the symbolic graph.
8. A Theano function is declared using the following syntax?
Answer
Explanation: A Theano function is declared using the following syntax : theano.function ([x], y)
9. The _________ method declares a decimal scalar variable.
View Answer
Explanation: The dscalar method declares a decimal scalar variable.
10. Theano was written at the LISA lab with the intention of providing rapid development of efficient machine learning algorithms.
View Answer
Explanation: True, Theano was written at the LISA lab with the intention of providing rapid development of efficient machine learning algorithms.
 List of Popular Projects at Github for Sample Lab and Exercise  September 23, 2023
 Dynatrace Tutorials: Dynatrace Managed Cluster on the AWS Cloud  September 23, 2023
 Dynatrace Tutorials: How to Generate a Dynatrace API Token  September 23, 2023