MCPcopy
hub / github.com/hunkim/PyTorchZeroToAll / cuda_variable

Function cuda_variable

seq2seq_models.py:17–22  ·  view source on GitHub ↗
(tensor)

Source from the content-addressed store, hash-verified

15
16
17def cuda_variable(tensor):
18 # Do cuda() before wrapping with variable
19 if torch.cuda.is_available():
20 return Variable(tensor.cuda())
21 else:
22 return Variable(tensor)
23
24
25# Sting to char tensor

Callers 5

testFunction · 0.90
str2tensorFunction · 0.85
init_hiddenMethod · 0.85
init_hiddenMethod · 0.85
get_att_weightMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected