1

http://deeplearning.net/tutorial/SdA.html#sdaのチュートリアル Stacked DenoisingAutoencodersでは、pretraining_functions は、各 dA レイヤーのトレーニング関数を表す関数のリストを返します。しかし、すべての dA レイヤーに同じ入力 ( ) を与える理由がわかりませんtrain_set_x。実際には、各 dA レイヤーの入力は、最初の dA レイヤーを除く下のレイヤーの出力である必要があります。これらのコードが正しい理由を誰か教えてもらえますか?

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)
4

1 に答える 1

0

各隠れ層の入力は前の層の出力として構成されているため、次のようになります。

# 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

事前トレーニング関数のinセクションに設定self.xすると、実際に theano が 1 つのレイヤーから別のレイヤーに入力を伝播するようになるため、2 番目のレイヤーを事前トレーニングすると、入力は最初のレイヤーを介して伝播され、次に 2 番目のレイヤーによって処理されます。train_set_x[batch_begin:batch_end]givens

チュートリアルの最後をよく見ると、レイヤーごとに明示的な入力を事前計算することでトレーニングの実行時間を短縮する方法のヒントがあります。

于 2014-07-17T18:21:17.970 に答える