def make_exchange_func(a, b):
 updates = OrderedDict()
 updates[a] = b
 updates[b] = a
 f = function([], updates=updates)
 return f

def make_exchange_func ( a , b ) : updates = OrderedDict ( ) updates [ a ] = b updates [ b ] = a f = function ( [ ] , updates = updates ) return f
a: a theano shared variable b: a theano shared variable returns f where f is a theano function .