Commit 9161efbc by Neo Chien Committed by Tianqi Chen

Fix the potential index overflow (#3751)

parent d6b7b62d
......@@ -1451,9 +1451,10 @@ bool WhereRel(const Array<Type>& types,
CHECK(reporter->AssertEQ(x_shape[i], y_shape[i]))
<< "x and y must have the same shape: " << x_shape << " vs " << y_shape;
CHECK(reporter->AssertEQ(cond_shape[i], x_shape[i]))
<< "Shape of condition " << condition->shape
<< " must be either equal to x or has dimension of 1.";
if (i < cond_shape.size()) {
CHECK(reporter->AssertEQ(cond_shape[i], x_shape[i]))
<< "condition and x must have the same shape: " << cond_shape << " vs " << x_shape;
}
}
reporter->Assign(types[3], TensorTypeNode::make(x_shape, x->dtype));
return true;
......
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