(self, **kwargs)
| 143 | self.classifier = nn.Linear(fea_dim,2) |
| 144 | |
| 145 | def forward(self, **kwargs): |
| 146 | comments_inputid = kwargs['comments_inputid'] |
| 147 | comments_mask=kwargs['comments_mask'] |
| 148 | comments_feature=[] |
| 149 | for i in range(comments_inputid.shape[0]): |
| 150 | bert_fea=self.bert(comments_inputid[i], attention_mask=comments_mask[i])[1] |
| 151 | comments_feature.append(bert_fea) |
| 152 | comments_feature=torch.stack(comments_feature) |
| 153 | fea_comments=self.linear_comment(comments_feature) |
| 154 | print (fea_comments.shape) |
| 155 | fea_comments = self.attention(fea_comments) |
| 156 | fea_comments = torch.mean(fea_comments, -2) |
| 157 | output = self.classifier(fea_comments) |
| 158 | return output |
| 159 | |
| 160 |
nothing calls this directly
no outgoing calls
no test coverage detected