| 70 | } |
| 71 | |
| 72 | Expression classify(ComputationGraph & cg, Instance & inst) { |
| 73 | unsigned n_sents = inst.first.size(); |
| 74 | std::vector<Expression> sent_repr(n_sents); |
| 75 | get_sentence_repr(cg, inst, sent_repr); |
| 76 | Expression doc_repr = get_document_repr(cg, sent_repr); |
| 77 | Expression logits = get_logits(cg, doc_repr); |
| 78 | return logits; |
| 79 | } |
| 80 | |
| 81 | Expression objective(ComputationGraph & cg, Instance & inst, Expression & logits) { |
| 82 | return pickneglogsoftmax(logits, inst.second); |