0b0eabbfd972c9e3f6323bff9d39ac5fc3ba9cc7,transformer/Translator.py,Translator,translate_batch,#Translator#Any#,52

Before Change


            // 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()

After Change


        sz_b, len_s = src_seq.size()
        src_seq = src_seq.repeat(1, sz_beam).view(sz_b * sz_beam, len_s)

        sz_b, len_s, d_h = enc_output.size()
        enc_output = enc_output.repeat(1, sz_beam, 1).view( sz_b * sz_beam, len_s, d_h)

        //--- Prepare beams
        beams = [Beam(sz_beam, self.opt.cuda) for _ in range(batch_size)]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

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: KaiyangZhou/deep-person-reid
Commit Name: cd80a074396caa42b81068115c9b066f4ce08414
Time: 2018-04-26
Author: k.zhou@qmul.ac.uk
File Name: train_vid_model_xent_htri.py
Class Name:
Method Name: test


Project Name: KaiyangZhou/deep-person-reid
Commit Name: cd80a074396caa42b81068115c9b066f4ce08414
Time: 2018-04-26
Author: k.zhou@qmul.ac.uk
File Name: train_vid_model_xent.py
Class Name:
Method Name: test


Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 09b05581ca7cf0ccac1da967c3f824d30924a3a5
Time: 2018-05-04
Author: eriklindernoren@live.se
File Name: implementations/dualgan/dualgan.py
Class Name:
Method Name: compute_gradient_penalty