diff options
author | John Langford <jl@hunch.net> | 2011-06-21 04:26:43 +0400 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2011-06-21 04:26:43 +0400 |
commit | 0752d03f6213ea149f7b08f3846b8421f52e061e (patch) | |
tree | 38d95f86860849ad47d68b8e31aff1a3d8c0ca5d /parse_regressor.cc | |
parent | 78bc07c9e5aad2a5550cfd942286f88968570f09 (diff) |
fix empty model reading bug from Vaclav
Diffstat (limited to 'parse_regressor.cc')
-rw-r--r-- | parse_regressor.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/parse_regressor.cc b/parse_regressor.cc index 83c91623..351cc402 100644 --- a/parse_regressor.cc +++ b/parse_regressor.cc @@ -182,13 +182,16 @@ void parse_regressor_args(po::variables_map& vm, regressor& r, string& final_reg regressor.read((char *)&w, sizeof(float)); size_t num_threads = global.num_threads(); - if (regressor.good() && global.lda == 0) - r.weight_vectors[hash % num_threads][(hash*stride)/num_threads] - = r.weight_vectors[hash % num_threads][(hash*stride)/num_threads] + w; - else - r.weight_vectors[hash % num_threads][hash/num_threads] - = r.weight_vectors[hash % num_threads][hash/num_threads] + w; - } + if (regressor.good()) + { + if (global.lda == 0) + r.weight_vectors[hash % num_threads][(hash*stride)/num_threads] + = r.weight_vectors[hash % num_threads][(hash*stride)/num_threads] + w; + else + r.weight_vectors[hash % num_threads][hash/num_threads] + = r.weight_vectors[hash % num_threads][hash/num_threads] + w; + } + } regressor.close(); } if (!initialized) |