@@ -466,7 +466,7 @@ def __init__(self, hidden_size, output_size, n_layers=1, dropout_p=0.1, max_leng
466
466
self .gru = nn .GRU (self .hidden_size , self .hidden_size )
467
467
self .out = nn .Linear (self .hidden_size , self .output_size )
468
468
469
- def forward (self , input , hidden , encoder_output , encoder_outputs ):
469
+ def forward (self , input , hidden , encoder_outputs ):
470
470
embedded = self .embedding (input ).view (1 , 1 , - 1 )
471
471
embedded = self .dropout (embedded )
472
472
@@ -591,15 +591,15 @@ def train(input_variable, target_variable, encoder, decoder, encoder_optimizer,
591
591
# Teacher forcing: Feed the target as the next input
592
592
for di in range (target_length ):
593
593
decoder_output , decoder_hidden , decoder_attention = decoder (
594
- decoder_input , decoder_hidden , encoder_output , encoder_outputs )
594
+ decoder_input , decoder_hidden , encoder_outputs )
595
595
loss += criterion (decoder_output , target_variable [di ])
596
596
decoder_input = target_variable [di ] # Teacher forcing
597
597
598
598
else :
599
599
# Without teacher forcing: use its own predictions as the next input
600
600
for di in range (target_length ):
601
601
decoder_output , decoder_hidden , decoder_attention = decoder (
602
- decoder_input , decoder_hidden , encoder_output , encoder_outputs )
602
+ decoder_input , decoder_hidden , encoder_outputs )
603
603
topv , topi = decoder_output .data .topk (1 )
604
604
ni = topi [0 ][0 ]
605
605
@@ -745,7 +745,7 @@ def evaluate(encoder, decoder, sentence, max_length=MAX_LENGTH):
745
745
746
746
for di in range (max_length ):
747
747
decoder_output , decoder_hidden , decoder_attention = decoder (
748
- decoder_input , decoder_hidden , encoder_output , encoder_outputs )
748
+ decoder_input , decoder_hidden , encoder_outputs )
749
749
decoder_attentions [di ] = decoder_attention .data
750
750
topv , topi = decoder_output .data .topk (1 )
751
751
ni = topi [0 ][0 ]
0 commit comments