| 331 | # |
| 332 | |
| 333 | class EncoderRNN(nn.Module): |
| 334 | def __init__(self, input_size, hidden_size, dropout_p=0.1): |
| 335 | super(EncoderRNN, self).__init__() |
| 336 | self.hidden_size = hidden_size |
| 337 | |
| 338 | self.embedding = nn.Embedding(input_size, hidden_size) |
| 339 | self.gru = nn.GRU(hidden_size, hidden_size, batch_first=True) |
| 340 | self.dropout = nn.Dropout(dropout_p) |
| 341 | |
| 342 | def forward(self, input): |
| 343 | embedded = self.dropout(self.embedding(input)) |
| 344 | output, hidden = self.gru(embedded) |
| 345 | return output, hidden |
| 346 | |
| 347 | ###################################################################### |
| 348 | # The Decoder |
no outgoing calls
no test coverage detected