【问题标题】:What arguments does "sequences" paramater take in theano.scan and how are they interpreted“序列”参数在 theano.scan 中接受哪些参数以及如何解释它们
【发布时间】:2016-11-20 03:29:29
【问题描述】:

我从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)

这里的代码是为了解释“sequences”参数。 这是我的问题:

  1. 如何输入序列?第一项“系数”是张量变量。第二项“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."
    

    根据“序列”中提供的参数,这里的循环是如何发生的?

【问题讨论】:

    标签: python-2.7 theano theano.scan


    【解决方案1】:

    参数的顺序是:sequence[t],outputs_infor,non_sequence

     coefficients[t]
     theano.tensor.arange(max_coefficients_supported)[t]
     x
    

    outputs_infor 保存上一次迭代的结果

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-20
      • 2018-04-24
      • 2010-12-06
      • 1970-01-01
      相关资源
      最近更新 更多