I've read the official documenation and read the comments here https://github.com/Theano/theano/blob/ddfd7d239a1e656cee850cdbc548da63f349c37d/theano/compile/function.py#L74-L324, and one man told me that it tells Theano to compile the symbolic computation graph into an actual program that you can run.
However, I still cannot figure out how does it know, for example in this code:
self.update_fun = theano.function(
I'm no expert but here's my take at explaining it:
Yes the 'body' is defined in the code above. But
theano doesn't 'interpret' that code directly like the python interpreter would. The code in question is just creating
theano objects that will allow
theano to compile the desired function. Let's take a simple example: how you would create a function
f(x) = 2x + x**3.
You first create a symbolic input variable
x. Then you define the 'body' of the function by building the symbolic expression of
y = 2 * x + x**3 # defines a new symbolic variable which depends on x
y object is equivalent to a graph representing the formula. Something like
You finally call
theano does its magic and compiles the actual function
f(x) = y = 2 * x + x**3 from the information (the graph) 'contained' in
Does it make things clearer?