Skip to content

Commit e2c2d83

Browse files
author
Sean Naren
authored
Merge pull request #216 from taras-sereda/master
simplified batch softmax
2 parents 87fd100 + c31416e commit e2c2d83

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

model.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ def __repr__(self):
4242
class InferenceBatchSoftmax(nn.Module):
4343
def forward(self, input_):
4444
if not self.training:
45-
batch_size = input_.size()[0]
46-
return torch.stack([F.softmax(input_[i], dim=1) for i in range(batch_size)], 0)
45+
return F.softmax(input_, dim=-1)
4746
else:
4847
return input_
4948

0 commit comments

Comments
 (0)