Skip to content

Commit 35719f3

Browse files
authored
Again further fix bugs in CaptionModel in sample_beam
1 parent 4880150 commit 35719f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/CaptionModel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def sample_beam(self, fc_feats, att_feats, opt={}):
9696
self.done_beams = [[] for _ in range(batch_size)]
9797
for k in range(batch_size):
9898
tmp_fc_feats = fc_feats[k:k+1].expand(beam_size, self.fc_feat_size)
99-
tmp_att_feats = att_feats[k:k+1].expand(*((beam_size,)+att_feats.size()[1:]))
99+
tmp_att_feats = att_feats[k:k+1].expand(*((beam_size,)+att_feats.size()[1:])).contiguous()
100100

101101
state = self.init_hidden(tmp_fc_feats)
102102

0 commit comments

Comments
 (0)