theano.scan返回两个变量:values变量和更新变量.例如,
a = theano.shared(1)
values, updates = theano.scan(fn=lambda a:a+1, outputs_info=a, n_steps=10)
Run Code Online (Sandbox Code Playgroud)
但是,我注意到在我使用的大多数示例中,updates变量都是空的.似乎只有当我们theano.scan以某种方式编写函数时,我们才会获得更新.例如,
a = theano.shared(1)
values, updates = theano.scan(lambda: {a: a+1}, n_steps=10)
Run Code Online (Sandbox Code Playgroud)
有人可以向我解释为什么在第一个例子中更新是空的,但在第二个例子中,更新变量不为空?更一般地说,更新如何变量theano.scan起作用?谢谢.