首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >堆叠DenoisingAutoencoders的实现-为什么对dA层使用相同的输入?

堆叠DenoisingAutoencoders的实现-为什么对dA层使用相同的输入?
EN

Stack Overflow用户
提问于 2014-07-07 16:40:34
回答 1查看 297关注 0票数 1

http://deeplearning.net/tutorial/SdA.html#sda上的堆叠DenoisingAutoencoders教程中,pretraining_functions返回一个函数列表,这些函数表示每个dA层的训练函数。但是我不明白为什么它给所有的dA层提供相同的输入(train_set_x)。实际上,除了第一个dA层之外,每个dA层的输入都应该是下一层的输出。谁能告诉我为什么这些代码是正确的?

代码语言:javascript
复制
pretrain_fns = []
for dA in self.dA_layers:
    # get the cost and the updates list
    cost, updates = dA.get_cost_updates(corruption_level, learning_rate)
    # compile the theano function
    fn = theano.function(inputs=[index,
                      theano.Param(corruption_level, default=0.2),
                      theano.Param(learning_rate, default=0.1)],
            outputs=cost,
            updates=updates,
            givens={self.x: train_set_x[batch_begin:batch_end]})
    # append `fn` to the list of functions
    pretrain_fns.append(fn)
EN

回答 1

Stack Overflow用户

发布于 2014-07-18 02:21:18

由于每个隐藏层的输入被配置为上一层的输出:

代码语言:javascript
复制
# the input to this layer is either the activation of the hidden
# layer below or the input of the SdA if you are on the first
# layer
if i == 0:
    layer_input = self.x
else:
    layer_input = self.sigmoid_layers[-1].output

当在预训练函数的givens部分中将self.x设置为train_set_x[batch_begin:batch_end]时,它实际上会使theano将输入从一层传播到另一层,因此当您预训练第二层时,输入将首先传播到第一层,然后由第二层处理。

如果你仔细观察tutorial的结尾,你会发现一个技巧,如何通过预先计算每层的显式输入来减少训练运行时间。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24606346

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档