Skip to content

Instantly share code, notes, and snippets.

@xiangze
Created July 18, 2015 07:38
Show Gist options
  • Save xiangze/8ce34d1adcf26b64e32d to your computer and use it in GitHub Desktop.
Save xiangze/8ce34d1adcf26b64e32d to your computer and use it in GitHub Desktop.
from theano import tensor as T
from theano import function, shared
import numpy
X = shared(numpy.array([0,1,2,3,4]))
Y = T.vector()
#X_update = (X, T.set_subtensor(X[2:4], Y))
X_update = (X, T.set_subtensor(X[:], Y))
#X_update = (X, Y)
f = function([Y], updates=[X_update])
#f([100,10])
f([0,1,100,10,4])
print X.get_value() # [0 1 100 10 4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment