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

Method init_hidden

13_3_char_rnn.py:39–45  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

37 return output, hidden
38
39 def init_hidden(self):
40 if torch.cuda.is_available():
41 hidden = torch.zeros(self.n_layers, 1, self.hidden_size).cuda()
42 else:
43 hidden = torch.zeros(self.n_layers, 1, self.hidden_size)
44
45 return Variable(hidden)
46
47
48def str2tensor(string):

Callers 8

generateFunction · 0.45
train_teacher_forchingFunction · 0.45
trainFunction · 0.45
trainFunction · 0.45
translateFunction · 0.45
testFunction · 0.45
trainFunction · 0.45
translateFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected