Skip to content

Commit

Permalink
Added proper cuda support for mask
Browse files Browse the repository at this point in the history
  • Loading branch information
sean.narenthiran committed Jul 12, 2018
1 parent 78e1607 commit c959d29
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion model.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def forward(self, x, lengths):
"""
for module in self.seq_module:
x = module(x)
mask = torch.ByteTensor(x.size()).fill_(0).cuda() # TODO don't hard-code cuda
mask = torch.ByteTensor(x.size()).fill_(0)
if x.is_cuda:
mask = mask.cuda()
for i, length in enumerate(lengths):
length = length.item()
if (mask[i].size(2) - length) > 0:
Expand Down

0 comments on commit c959d29

Please sign in to comment.