Skip to content

Commit b796bf2

Browse files
committed
more checks.
1 parent 991c601 commit b796bf2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/data/data.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,15 @@ void MetaInfo::SetInfo(Context const& ctx, StringView key, StringView interface_
572572
// it.
573573
if (this->num_row_ != 0 && this->base_margin_.Shape(0) != this->num_row_) {
574574
// API functions that don't use array interface don't understand shape.
575-
CHECK(this->base_margin_.Size() % this->num_row_ == 0)
575+
CHECK_EQ(this->base_margin_.Size() % this->num_row_, 0)
576576
<< "Invalid size for base margin:(" << base_margin_.Shape(0) << "," << base_margin_.Shape(1)
577577
<< "). n_samples:" << this->num_row_;
578578
size_t n_groups = this->base_margin_.Size() / this->num_row_;
579579
this->base_margin_.Reshape(this->num_row_, n_groups);
580580
}
581+
if (this->num_row_ != 0 && this->labels.Shape(0) != this->num_row_) {
582+
CHECK_EQ(this->labels.Shape(0) % this->num_row_, 0);
583+
}
581584
}
582585

583586
void MetaInfo::SetInfoFromHost(Context const* ctx, StringView key, Json arr) {

0 commit comments

Comments
 (0)