Method
__init__
(self, in_size, hidden_size, dropout, num_layers=1, bidirectional=False)
Source from the content-addressed store, hash-verified
| 48 | ''' |
| 49 | |
| 50 | def __init__(self, in_size, hidden_size, dropout, num_layers=1, bidirectional=False): |
| 51 | |
| 52 | super(LSTMEncoder, self).__init__() |
| 53 | |
| 54 | if num_layers == 1: |
| 55 | rnn_dropout = 0.0 |
| 56 | else: |
| 57 | rnn_dropout = dropout |
| 58 | |
| 59 | self.rnn = nn.LSTM(in_size, hidden_size, num_layers=num_layers, dropout=rnn_dropout, bidirectional=bidirectional, batch_first=True) |
| 60 | self.dropout = nn.Dropout(dropout) |
| 61 | self.linear_1 = nn.Linear(hidden_size, hidden_size) |
| 62 | |
| 63 | def forward(self, x): |
| 64 | ''' |
Callers
nothing calls this directly
Tested by
no test coverage detected