Added some missing DLIB_ASSERT statements.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%404196
This commit is contained in:
Davis King 2011-03-24 02:08:31 +00:00
parent 640acab208
commit 0cd9fbd92a
2 changed files with 16 additions and 0 deletions

View File

@ -86,6 +86,14 @@ namespace dlib
const std::vector<label_type>& all_labels const std::vector<label_type>& all_labels
) const ) const
{ {
// make sure requires clause is not broken
DLIB_ASSERT(is_learning_problem(all_samples,all_labels),
"\t trained_function_type one_vs_all_trainer::train(all_samples,all_labels)"
<< "\n\t invalid inputs were given to this function"
<< "\n\t all_samples.size(): " << all_samples.size()
<< "\n\t all_labels.size(): " << all_labels.size()
);
const std::vector<label_type> distinct_labels = select_all_distinct_labels(all_labels); const std::vector<label_type> distinct_labels = select_all_distinct_labels(all_labels);
std::vector<scalar_type> labels; std::vector<scalar_type> labels;

View File

@ -88,6 +88,14 @@ namespace dlib
const std::vector<label_type>& all_labels const std::vector<label_type>& all_labels
) const ) const
{ {
// make sure requires clause is not broken
DLIB_ASSERT(is_learning_problem(all_samples,all_labels),
"\t trained_function_type one_vs_one_trainer::train(all_samples,all_labels)"
<< "\n\t invalid inputs were given to this function"
<< "\n\t all_samples.size(): " << all_samples.size()
<< "\n\t all_labels.size(): " << all_labels.size()
);
const std::vector<label_type> distinct_labels = select_all_distinct_labels(all_labels); const std::vector<label_type> distinct_labels = select_all_distinct_labels(all_labels);
std::vector<sample_type> samples; std::vector<sample_type> samples;