编译函数时theano,可以通过指定更新共享变量(比如X)updates=[(X, new_value)].现在我试图只更新共享变量的子集:
from theano import tensor as T
from theano import function
import numpy
X = T.shared(numpy.array([0,1,2,3,4]))
Y = T.vector()
f = function([Y], updates=[(X[2:4], Y)] # error occur:
# 'update target must
# be a SharedVariable'
Run Code Online (Sandbox Code Playgroud)
代码将引发错误"更新目标必须是SharedVariable",我猜这意味着更新目标不能是非共享变量.那么有没有办法编译一个函数只是udpate共享变量的子集?