(self, x)
| 162 | self.output_projection = nn.Linear(in_features=self.c_dim, out_features=self.out_dim) |
| 163 | |
| 164 | def forward(self, x): |
| 165 | # --- x \in (N, L, H_dim) --- |
| 166 | # --- outputs \in (L, N, H_dim) --- |
| 167 | x = torch.transpose(x, 0, 1) |
| 168 | outputs, (h_n, c_n) = self.lstm(x) |
| 169 | |
| 170 | # --- Only classify the last layer --- |
| 171 | out = self.output_projection(outputs) |
| 172 | |
| 173 | # --- out: (L, N, output_dim) --- |
| 174 | # --- First transpose: (N, L, output_dim) |
| 175 | # --- second transpose (N, output_dim, L) --- |
| 176 | return torch.transpose(torch.transpose(out, 0, 1), 1, 2) |
| 177 | |
| 178 | |
| 179 | # --- For argparse --- |
nothing calls this directly
no outgoing calls
no test coverage detected