input_batch = input_batch.to(device)
// Forward input through encoder model
encoder_outputs, encoder_hidden = encoder(input_batch, lengths)
// Prepare encoder"s final hidden layer to be first hidden input to the decoder
decoder_hidden = encoder_hidden[:decoder.n_layers]
After Change
input_batch = torch.LongTensor(indexes_batch).transpose(0, 1)
// Use appropriate device
input_batch = input_batch.to(device)
lengths = lengths.to(device)
// Decode sentence with searcher
tokens, scores = searcher(input_batch, lengths, max_length)
// indexes -> words
decoded_words = [voc.index2word[token.item()] for token in tokens]
return decoded_words
def evaluateInput(encoder, decoder, searcher, voc):