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

Method EmbedTarget

examples/sentence-embedding/train_embed-cl.cc:53–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 }
52
53 Expression EmbedTarget(const vector<int>& sent, ComputationGraph& cg) {
54 m.resize(sent.size() + 2);
55 m[0] = lookup(cg, p_s, kTRG_SOS);
56 int i = 1;
57 for (auto& w : sent)
58 m[i++] = lookup(cg, p_t, w);
59 m[i] = lookup(cg, p_s, kTRG_EOS);
60#ifdef DUMB_ADDITIVE
61 return sum(m);
62#else
63 return sum_cols(tanh(kmh_ngram(concatenate_cols(m), 2)));
64#endif
65 }
66
67};
68

Callers 1

mainFunction · 0.80

Calls 8

sumFunction · 0.85
lookupFunction · 0.50
sum_colsFunction · 0.50
tanhFunction · 0.50
kmh_ngramFunction · 0.50
concatenate_colsFunction · 0.50
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected