我从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."
根据“序列”中提供的参数,循环是如何发生的?
答案 0 :(得分:0)
参数的顺序是:sequence [t],outputs_infor,non_sequence
coefficients[t]
theano.tensor.arange(max_coefficients_supported)[t]
x
outputs_infor保存上一次迭代的结果