Deep Learning with Python

@Jason Brownlee


In [1]:
import theano

In [2]:
from theano import tensor

In [3]:
a = tensor.dscalar()
b = tensor.dscalar()

In [4]:
type(a)


Out[4]:
theano.tensor.var.TensorVariable

In [7]:
c = a + b    #Create a simple symbolic expression

In [8]:
#Convert the expression into a callable object that takes (a,b) and computes c
f = theano.function([a,b], c)

In [9]:
type(f)


Out[9]:
theano.compile.function_module.Function

In [12]:
result = f(1.5, 2.5)

In [13]:
print(result)


4.0

In [15]:
type(result)


Out[15]:
numpy.ndarray

In [ ]: