a61996ae5406ddfee4ac65ab647ebe858fc16260,beginner_source/chatbot_tutorial.py,,evaluate,#,1266

Before Change


    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):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: pytorch/tutorials
Commit Name: a61996ae5406ddfee4ac65ab647ebe858fc16260
Time: 2018-09-17
Author: matthewinkawhich@gmail.com
File Name: beginner_source/chatbot_tutorial.py
Class Name:
Method Name: evaluate


Project Name: pytorch/tutorials
Commit Name: 69d978ed497856d05730c05564597e604713f5c4
Time: 2018-09-16
Author: minkawhich@fb.com
File Name: beginner_source/chatbot_tutorial.py
Class Name:
Method Name: evaluate


Project Name: rusty1s/pytorch_geometric
Commit Name: 7be56405f2af0f700763249da3c368976582d792
Time: 2020-12-07
Author: matthias.fey@tu-dortmund.de
File Name: examples/tgn.py
Class Name:
Method Name: