MCPcopy Index your code
hub / github.com/pytorch/tutorials / CharRNN

Class CharRNN

intermediate_source/char_rnn_classification_tutorial.py:241–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239import torch.nn.functional as F
240
241class CharRNN(nn.Module):
242 def __init__(self, input_size, hidden_size, output_size):
243 super(CharRNN, self).__init__()
244
245 self.rnn = nn.RNN(input_size, hidden_size)
246 self.h2o = nn.Linear(hidden_size, output_size)
247 self.softmax = nn.LogSoftmax(dim=1)
248
249 def forward(self, line_tensor):
250 rnn_out, hidden = self.rnn(line_tensor)
251 output = self.h2o(hidden[0])
252 output = self.softmax(output)
253
254 return output
255
256
257###########################

Calls

no outgoing calls

Tested by

no test coverage detected