0b0eabbfd972c9e3f6323bff9d39ac5fc3ba9cc7,transformer/Translator.py,Translator,translate_batch,#Translator#,52
Before Change
// -- Preparing decoded data seq -- //
// size: batch x beam x seq
dec_partial_seq = torch.stack([
b.get_current_state() for b in beams if not b.done])
// size: (batch * beam) x seq
dec_partial_seq = dec_partial_seq.view(-1, len_dec_seq)
// wrap into a Variable
dec_partial_seq = Variable(dec_partial_seq, volatile=True)
// -- Preparing decoded pos seq -- //
// size: 1 x seq
dec_partial_pos = torch.arange(1, len_dec_seq + 1).unsqueeze(0)
// size: (batch * beam) x seq
dec_partial_pos = dec_partial_pos.repeat(n_remaining_sents * beam_size, 1)
// wrap into a Variable
dec_partial_pos = Variable(dec_partial_pos.type(torch.LongTensor), volatile=True)
if self.opt.cuda:
dec_partial_seq = dec_partial_seq.cuda()
dec_partial_pos = dec_partial_pos.cuda()
// -- Decoding -- //
After Change
// -- Preparing decoded data seq -- //
// size: batch x beam x seq
dec_partial_seq = torch.stack([
b.get_current_state() for b in beams if not b.done]).to(self.device)
// size: (batch * beam) x seq
dec_partial_seq = dec_partial_seq.view(-1, len_dec_seq)
// -- Preparing decoded pos seq -- //
// size: 1 x seq
dec_partial_pos = torch.arange(1, len_dec_seq + 1, dtype=torch.long, device=self.device)
// size: (batch * beam) x seq
dec_partial_pos = dec_partial_pos.unsqueeze(0).repeat(n_remaining_sents * sz_beam, 1)
if self.opt.cuda:
dec_partial_seq = dec_partial_seq.cuda()
dec_partial_pos = dec_partial_pos.cuda()
// -- Decoding -- //
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 2
Instances
Project Name: jadore801120/attention-is-all-you-need-pytorch
Commit Name: 0b0eabbfd972c9e3f6323bff9d39ac5fc3ba9cc7
Time: 2018-08-23
Author: yhhuang@nlg.csie.ntu.edu.tw
File Name: transformer/Translator.py
Class Name: Translator
Method Name: translate_batch
Project Name: khaotik/DaNet-Tensorflow
Commit Name: 80af54aaf660f06a9c1c83eb803abf1ddca9119a
Time: 2017-08-11
Author: junkkhaotik@gmail.com
File Name: main.py
Class Name:
Method Name: main
Project Name: scikit-image/scikit-image
Commit Name: 08250ae50815b32f868041bc56a6e5a3eca4ef83
Time: 2019-12-17
Author: xwu@enthought.com
File Name: skimage/transform/hough_transform.py
Class Name:
Method Name: hough_circle_peaks