In this example, we will compile functions that computes sum and difference given two real number.
from __future__ import print_function
import theano
import theano.tensor as T
#define two symbolic scalar
s_x = T.fscalar()
s_y = T.fscalar()
#compute something
s_sum = s_x + s_y
s_diff = s_x - s_y
#compile a function that adds two number
#theano will call system compiler at here
fn_add = theano.function(inputs=[s_x, s_y], outputs=s_sum)
fn_diff = theano.function(inputs=[s_x, s_y], outputs=s_diff)
#call the compiled functions
print(fn_add(2., 2.)) #4.
print(fn_diff(2., 2.)) #0.