One of my Theano functions does not take any inputs and only uses shared variables to calculate the output. But this function throws a TypeError: function() takes at least 1 argument (1 given)
.
Here a minimal example:
import theano as th
import theano.tensor as T
import numpy as np
x, y = T.dscalars('x', 'y')
z = th.shared(np.zeros(2))
f1 = th.function(inputs=[x], updates=[(z, z+x)])
f2 = th.function(outputs=z)
f1(3)
print f2()
Traceback (most recent call last):
File "/home/me/temp/theano.test.py", line 9, in <module>
f2 = th.function(updates=[(z, z*z)])
TypeError: function() takes at least 1 argument (1 given)