Browse Source

mask utils update for 0.4 cuda

master
Raul Puri 6 years ago
committed by GitHub
parent
commit
6fbba8ef0f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      utils.py

+ 1
- 1
utils.py View File

@ -5,7 +5,7 @@ import torch
def get_mask_from_lengths(lengths):
max_len = torch.max(lengths)
ids = torch.arange(0, max_len, out=torch.LongTensor(max_len)).cuda()
ids = torch.arange(0, max_len).long().cuda()
mask = (ids < lengths.unsqueeze(1)).byte()
return mask

Loading…
Cancel
Save