Commit 1291350f authored by Davis King's avatar Davis King

Added a missing assert.

parent dab7db37
......@@ -84,6 +84,34 @@ namespace dlib
labels(labels_),
fe(fe_)
{
// make sure requires clause is not broken
DLIB_ASSERT(is_sequence_labeling_problem(samples,labels) == true,
"\t structural_svm_sequence_labeling_problem::structural_svm_sequence_labeling_problem()"
<< "\n\t invalid inputs were given to this function"
<< "\n\t samples.size(): " << samples.size()
<< "\n\t is_sequence_labeling_problem(samples,labels): " << is_sequence_labeling_problem(samples,labels)
<< "\n\t this: " << this
);
#ifdef ENABLE_ASSERTS
for (unsigned long i = 0; i < labels.size(); ++i)
{
for (unsigned long j = 0; j < labels[i].size(); ++j)
{
// make sure requires clause is not broken
DLIB_ASSERT(labels[i][j] < fe.num_labels(),
"\t structural_svm_sequence_labeling_problem::structural_svm_sequence_labeling_problem()"
<< "\n\t The given labels in labels are invalid."
<< "\n\t labels[i][j]: " << labels[i][j]
<< "\n\t fe.num_labels(): " << fe.num_labels()
<< "\n\t i: " << i
<< "\n\t j: " << j
<< "\n\t this: " << this
);
}
}
#endif
}
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment