Skip to content
Permalink
Browse files

Fix bug: make padding as cuda tensor

  • Loading branch information...
j-min committed Jul 25, 2018
1 parent 58a13e2 commit ff32d8d7537421ee059ee9a2fb745e80041f0fee
Showing with 2 additions and 2 deletions.
  1. +2 −2 model/utils/pad.py
@@ -8,13 +8,13 @@ def pad(tensor, length):
var = tensor
if length > var.size(0):
return torch.cat([var,
torch.zeros(length - var.size(0), *var.size()[1:])])
torch.zeros(length - var.size(0), *var.size()[1:]).cuda()])
else:
return var
else:
if length > tensor.size(0):
return torch.cat([tensor,
torch.zeros(length - tensor.size(0), *tensor.size()[1:])])
torch.zeros(length - tensor.size(0), *tensor.size()[1:]).cuda()])
else:
return tensor

0 comments on commit ff32d8d

Please sign in to comment.
You can’t perform that action at this time.