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


    // words -> indexes
    indexes_batch = [indexesFromSentence(voc, sentence)]
    // Create lengths tensor
    lengths = torch.tensor([len(indexes) for indexes in indexes_batch])
    // Transpose dimensions of batch to match models" expectations
    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]
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: tiberiu44/TTS-Cube
Commit Name: 5312157a064a8227a763b20a2dcdd01f49805102
Time: 2018-11-05
Author: tibi@racai.ro
File Name: cube/models/vocoder.py
Class Name: BeeCoder
Method Name: synthesize