-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
vw_validate.cc
31 lines (27 loc) · 1.05 KB
/
vw_validate.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
Copyright (c) by respective owners including Yahoo!, Microsoft, and
individual contributors. All rights reserved. Released under a BSD (revised)
license as described in the file LICENSE.
*/
#include "global_data.h"
#include "vw_validate.h"
#include "vw_versions.h"
namespace VW
{
void validate_version(vw& all)
{ if (all.model_file_ver < LAST_COMPATIBLE_VERSION || all.model_file_ver > PACKAGE_VERSION)
THROW("Model has possibly incompatible version! " << all.model_file_ver.to_string());
}
void validate_min_max_label(vw& all)
{ if (all.sd->max_label < all.sd->min_label)
THROW("Max label cannot be less than min label.");
}
void validate_default_bits(vw& all, uint32_t local_num_bits)
{ if (all.default_bits != true && all.num_bits != local_num_bits)
THROW("-b bits mismatch: command-line " << all.num_bits << " != " << local_num_bits << " stored in model");
}
void validate_num_bits(vw& all)
{ if (all.num_bits > sizeof(size_t) * 8 - 3)
THROW("Only " << sizeof(size_t) * 8 - 3 << " or fewer bits allowed. If this is a serious limit, speak up.");
}
}