a | b/loss/utils.py | ||
---|---|---|---|
1 | import torch |
||
2 | |||
3 | |||
4 | def to_float_and_cuda(input): |
||
5 | # input = input.type(torch.FloatTensor) |
||
6 | # input = input.type(torch.LongTensor) |
||
7 | input = input.float() |
||
8 | input = input.cuda() |
||
9 | return input |
||
10 | |||
11 | |||
12 | def to_long_and_cuda(input): |
||
13 | # input = input.type(torch.FloatTensor) |
||
14 | # input = input.type(torch.LongTensor) |
||
15 | input = input.long() |
||
16 | input = input.cuda() |
||
17 | return input |