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

Function create_variable

13_2_rnn_classification.py:40–45  ·  view source on GitHub ↗
(tensor)

Source from the content-addressed store, hash-verified

38
39
40def create_variable(tensor):
41 # Do cuda() before wrapping with variable
42 if torch.cuda.is_available():
43 return Variable(tensor.cuda())
44 else:
45 return Variable(tensor)
46
47
48# pad sequences and sort the tensor

Callers 2

pad_sequencesFunction · 0.85
_init_hiddenMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected