我从 http://deeplearning.net/software/theano/library/scan.html 中获取了以下代码
import numpy
coefficients = theano.tensor.vector("coefficients")
x = T.scalar("x")
max_coefficients_supported = 10000
# Generate the components of the polynomial
components, updates = theano.scan(fn=lambda coefficient, power, free_variable: coefficient * (free_variable ** power),
outputs_info=None,
sequences=[coefficients, theano.tensor.arange(max_coefficients_supported)],
non_sequences=x)
这里的代码旨在解释"序列"参数。这是我的问题:
序列是如何喂养的?第一项"系数"是一个张量变量。第二个术语"theano.tensor.arange(max_coefficients)"是一个张量变量,在使用eval()时给出一个带有[0......999]的列表。教程说——
"The tensor(s) to be looped over should be provided to scan using the sequence keyword argument."
根据此处在"序列"中提供的参数,循环如何发生?
参数的顺序是:sequence[t],outputs_infor,non_sequence
coefficients[t]
theano.tensor.arange(max_coefficients_supported)[t]
x
outputs_infor保存上一次迭代的结果