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

Method DocumentModel

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

Source from the content-addressed store, hash-verified

58 Parameter p_obias;
59
60 DocumentModel(ParameterCollection & m) :
61 p_w(m.add_lookup_parameters(VOCAB_SIZE, { INPUT_DIM })),
62 fwd_sent_builder(N_LAYERS, INPUT_DIM, SENTENCE_DIM, m),
63 bwd_sent_builder(N_LAYERS, INPUT_DIM, SENTENCE_DIM, m),
64 fwd_doc_builder(N_LAYERS, SENTENCE_DIM * 2, DOCUMENT_DIM, m),
65 bwd_doc_builder(N_LAYERS, SENTENCE_DIM * 2, DOCUMENT_DIM, m),
66 p_d2h(m.add_parameters({ HIDDEN_DIM , DOCUMENT_DIM * 2 })),
67 p_hbias(m.add_parameters({ HIDDEN_DIM })),
68 p_h2o(m.add_parameters({ LABEL_SIZE, HIDDEN_DIM })),
69 p_obias(m.add_parameters({ LABEL_SIZE })) {
70 }
71
72 Expression classify(ComputationGraph & cg, Instance & inst) {
73 unsigned n_sents = inst.first.size();

Callers

nothing calls this directly

Calls 2

add_lookup_parametersMethod · 0.45
add_parametersMethod · 0.45

Tested by

no test coverage detected