(self, x, x_len, x_mask)
| 160 | return logits_list |
| 161 | |
| 162 | def forward(self, x, x_len, x_mask): |
| 163 | x_emb = torch.cat((self.gen_embedding(x), self.domain_embedding(x)), dim=2) |
| 164 | x_emb = self.dropout(x_emb).transpose(1, 2) |
| 165 | x_conv = torch.nn.functional.relu(torch.cat((self.conv1(x_emb), self.conv2(x_emb)), dim=1)) |
| 166 | x_conv = self.dropout(x_conv) |
| 167 | x_conv = torch.nn.functional.relu(self.conv3(x_conv)) |
| 168 | x_conv = self.dropout(x_conv) |
| 169 | x_conv = torch.nn.functional.relu(self.conv4(x_conv)) |
| 170 | x_conv = self.dropout(x_conv) |
| 171 | x_conv = torch.nn.functional.relu(self.conv5(x_conv)) |
| 172 | x_conv = x_conv.transpose(1, 2) |
| 173 | x_conv = x_conv[:, :x_len[0], :] |
| 174 | |
| 175 | feature_attention = self.attention_layer.forward_perceptron(x_conv, x_conv, x_mask[:, :x_len[0]]) |
| 176 | x_conv = x_conv + feature_attention |
| 177 | |
| 178 | x_conv = x_conv.unsqueeze(2).expand([-1, -1, x_len[0], -1]) |
| 179 | x_conv_T = x_conv.transpose(1, 2) |
| 180 | features = torch.cat([x_conv, x_conv_T], dim=3) |
| 181 | |
| 182 | logits = self.multi_hops(features, x_len, x_mask, self.args.nhops) |
| 183 | return [logits[-1]] |
| 184 |
nothing calls this directly
no test coverage detected