未验证 提交 40cf6e64 编写于 作者: F Fisher 提交者: GitHub

[CINN] Fix test_dot_merger segmentation fault (#55667)

test_dot_merger和test_dot_merger_pass在CI和本地环境中会随机出现segmentation fault错误,导致单测随机挂,经排查后发现是ginac库相关的问题,现避免使用MathIsZero绕过
上级 7470889f
......@@ -553,14 +553,17 @@ ir::Tensor _Tensor_::Reshape(const std::vector<Expr> &shape,
auto selft = Tensor(const_cast<ir::_Tensor_ *>(this));
{
Expr this_num_elements = Expr(1);
for (auto &e : this->shape) this_num_elements = this_num_elements * e;
int32_t this_num_elements = 1;
for (auto &e : this->shape) {
this_num_elements = this_num_elements * e.as_int32();
}
Expr num_elements = Expr(1);
for (auto &e : shape) num_elements = num_elements * e;
int32_t num_elements = 1;
for (auto &e : shape) {
num_elements = num_elements * e.as_int32();
}
CHECK(MathIsZero(this_num_elements - num_elements))
<< "number of elements mismatch";
CHECK_EQ(this_num_elements, num_elements) << "number of elements mismatch.";
}
n->name = Context::Global().NewName(name + "_reshape");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册