Skip to content

Commit f2d5a6a

Browse files
replace decoder with self.decoder in PyTorch Chatbot example. (#3090)
Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
1 parent 1428770 commit f2d5a6a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

beginner_source/chatbot_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ def forward(self, input_seq, input_length, max_length):
11281128
# Forward input through encoder model
11291129
encoder_outputs, encoder_hidden = self.encoder(input_seq, input_length)
11301130
# Prepare encoder's final hidden layer to be first hidden input to the decoder
1131-
decoder_hidden = encoder_hidden[:decoder.n_layers]
1131+
decoder_hidden = encoder_hidden[:self.decoder.n_layers]
11321132
# Initialize decoder input with SOS_token
11331133
decoder_input = torch.ones(1, 1, device=device, dtype=torch.long) * SOS_token
11341134
# Initialize tensors to append decoded words to

0 commit comments

Comments
 (0)