7e34c0f98929f6c8cd5bc98c614e93efd629f1e5,models/AttModel.py,AttModel,_sample_beam,#AttModel#Any#Any#Any#Any#,163

Before Change


            state = self.init_hidden(beam_size)
            tmp_fc_feats = p_fc_feats[k:k+1].expand(beam_size, p_fc_feats.size(1))
            tmp_att_feats = p_att_feats[k:k+1].expand(*((beam_size,)+p_att_feats.size()[1:])).contiguous()
            tmp_p_att_feats = pp_att_feats[k:k+1].expand(*((beam_size,)+pp_att_feats.size()[1:])).contiguous()
            tmp_att_masks = p_att_masks[k:k+1].expand(*((beam_size,)+p_att_masks.size()[1:])).contiguous() if att_masks is not None else None

            for t in range(1):

After Change


        self.done_beams = [[] for _ in range(batch_size)]
        for k in range(batch_size):
            state = self.init_hidden(beam_size)
            tmp_fc_feats, tmp_att_feats, tmp_p_att_feats, tmp_att_masks = self.repeat_tensors(beam_size,
                p_fc_feats[k:k+1], p_att_feats[k:k+1], pp_att_feats[k:k+1], p_att_masks[k:k+1] if att_masks is not None else None
            )

            for t in range(1):
                if t == 0: // input <bos>
                    it = fc_feats.new_zeros([beam_size], dtype=torch.long)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: ruotianluo/ImageCaptioning.pytorch
Commit Name: 7e34c0f98929f6c8cd5bc98c614e93efd629f1e5
Time: 2019-12-26
Author: rluo@ttic.edu
File Name: models/AttModel.py
Class Name: AttModel
Method Name: _sample_beam


Project Name: ruotianluo/ImageCaptioning.pytorch
Commit Name: 86b3be6377440dd57be32c92884f9405b4f510a7
Time: 2020-01-30
Author: rluo@ttic.edu
File Name: models/AttModel.py
Class Name: AttModel
Method Name: _sample_beam