(self, x)
| 49 | self.fc = nn.Linear(hidden_size, num_classes) |
| 50 | |
| 51 | def forward(self, x): |
| 52 | # x shape is (batch_size, seq_len, input_size) |
| 53 | h0, c0 = self.init_state(x.size(0)) |
| 54 | output, (hn, cn) = self.LSTM(x, (h0, c0)) |
| 55 | # size = 1 |
| 56 | size = x.size(1) // 4 |
| 57 | |
| 58 | output = output[:, -size:, :] |
| 59 | scores = self.fc(output.squeeze(0)) |
| 60 | # scores shape is (batch_size, num_classes) |
| 61 | return scores |
| 62 | |
| 63 | def init_state(self, batch_size): |
| 64 | return ( |
nothing calls this directly
no test coverage detected