diff options
author | Rico Sennrich <rico.sennrich@gmx.ch> | 2014-07-04 11:35:07 +0400 |
---|---|---|
committer | Rico Sennrich <rico.sennrich@gmx.ch> | 2014-07-04 11:35:07 +0400 |
commit | d80c555766318cbf285d663172bf4852d4871b46 (patch) | |
tree | 98c3ce19098a679a8d067b1eb8fb6348dccef2dc | |
parent | 5654a28466d7956f0dd96d6e001d8f50f48b173b (diff) |
allow premultiplication during initialization
-rw-r--r-- | src/neuralLM.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/neuralLM.h b/src/neuralLM.h index 104b2cc..ffe6ae7 100644 --- a/src/neuralLM.h +++ b/src/neuralLM.h @@ -28,13 +28,15 @@ class neuralLMShared { vocabulary input_vocab, output_vocab; model nn; - explicit neuralLMShared(const std::string &filename) { + explicit neuralLMShared(const std::string &filename, bool premultiply = false) { std::vector<std::string> input_words, output_words; nn.read(filename, input_words, output_words); input_vocab = vocabulary(input_words); output_vocab = vocabulary(output_words); // this is faster but takes more memory - //nn.premultiply(); + if (premultiply) { + nn.premultiply(); + } } }; @@ -63,8 +65,8 @@ class neuralLM int start, null; public: - neuralLM(const std::string &filename) - : shared(new neuralLMShared(filename)), + neuralLM(const std::string &filename, bool premultiply = false) + : shared(new neuralLMShared(filename, premultiply)), ngram_size(shared->nn.ngram_size), normalization(false), weight(1.), |