1

자습서 Stacked DenoisingAutoencoders에서 http://deeplearning.net/tutorial/SdA.html#sda에있는 pretraining_functions는 각 dA 레이어의 열차 기능을 나타내는 함수 목록을 반환합니다. 하지만 왜 모든 dA 레이어에 동일한 입력 (train_set_x)을 제공하는지 이해할 수 없습니다. 실제로, 각 dA 층의 입력은 첫 번째 dA 층을 제외한 아래의 층의 출력이어야합니다. 아무도 왜이 코드가 올바른지 말해 줄 수 있습니까? 각 은닉층의 입력 이후Stacked DenoisingAutoencoders의 Theano 구현 - 왜 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) 

답변

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 

실제로 입력 전파 theano하게 pretraining 기능 givens 섹션 train_set_x[batch_begin:batch_end]self.x 설정하면 한 레이어에서 다른 레이어로 이동하므로 두 번째 레이어를 미리 트레이닝 할 때 입력이 첫 번째 레이어를 통해 전파 된 다음 두 번째 레이어로 처리됩니다.

tutorial의 끝 부분을 자세히 살펴보면 레이어 당 명시적인 입력을 사전 계산하여 교육 실행 시간을 줄이는 방법에 대한 팁이 있습니다.

+0

감사합니다.하지만 왜 theano가 입력을 다음 계층으로 전파 할 수 있는지 이해하지 못합니다. 함수에 특정 매개 변수 만 제공하기 때문입니다. 각 레이어의 정의는 맞지만 train_set_x는주기 동안 변경되지 않았습니다. –

+0

@love_carrot 그래프를 인쇄 해보고 어떻게 흐르게하는지 보면 두 번째 입력에 대해 처리 된 한 레이어의 입력이 표시됩니다. – Shai