(self, batch)
| 54 | param_group["lr"] = 0 |
| 55 | |
| 56 | def forward(self, batch): |
| 57 | if self.config.feature.feature_names[0] == "token": |
| 58 | embedding = self.token_embedding( |
| 59 | batch[cDataset.DOC_TOKEN].to(self.config.device)) |
| 60 | else: |
| 61 | embedding = self.char_embedding( |
| 62 | batch[cDataset.DOC_CHAR].to(self.config.device)) |
| 63 | embedding = embedding.transpose(1, 2) |
| 64 | pooled_outputs = [] |
| 65 | for i, conv in enumerate(self.convs): |
| 66 | #convolution = torch.nn.ReLU(conv(embedding)) |
| 67 | convolution = torch.nn.functional.relu(conv(embedding)) |
| 68 | pooled = torch.topk(convolution, self.top_k)[0].view( |
| 69 | convolution.size(0), -1) |
| 70 | pooled_outputs.append(pooled) |
| 71 | |
| 72 | doc_embedding = torch.cat(pooled_outputs, 1) |
| 73 | return self.dropout(self.linear(doc_embedding)) |
nothing calls this directly
no outgoing calls
no test coverage detected