From: https://stackoverflow.com/a/16782594/380038
"theano.function()
always needs a list of inputs. If the function takes 0 input, like in this case, you need to give an empty list for the inputs."
f2 = th.function(outputs=z)
has to be f2 = th.function([], outputs=z)