MCPcopy Create free account
hub / github.com/clab/dynet / classify

Method classify

examples/document-classification/train_imdb.cc:72–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);

Callers 1

mainFunction · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected