| 239 | import torch.nn.functional as F |
| 240 | |
| 241 | class 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 | ########################### |
no outgoing calls
no test coverage detected