diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2011-09-14 14:43:03 +0100 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2011-09-14 14:43:03 +0100 |
commit | fc5c72f9c5ce60c5d9a3dcd363eb51ccdd543bc9 (patch) | |
tree | 021c101ad5d331cb852eae16efc84f7120da364f /pro-train | |
parent | 9ba06c6f1a7e751da245219da291e329efa2b7e5 (diff) |
fix for potential segv with no weights
Diffstat (limited to 'pro-train')
-rw-r--r-- | pro-train/mr_pro_reduce.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pro-train/mr_pro_reduce.cc b/pro-train/mr_pro_reduce.cc index e71347ba..6b491918 100644 --- a/pro-train/mr_pro_reduce.cc +++ b/pro-train/mr_pro_reduce.cc @@ -100,7 +100,7 @@ double TrainingInference(const vector<weight_t>& x, vector<weight_t>* g = NULL) { double cll = 0; for (int i = 0; i < corpus.size(); ++i) { - const double dotprod = corpus[i].second.dot(x) + x[0]; // x[0] is bias + const double dotprod = corpus[i].second.dot(x) + (x.size() ? x[0] : weight_t()); // x[0] is bias double lp_false = dotprod; double lp_true = -dotprod; if (0 < lp_true) { |