[BUGFIX] Seg fault in memory planing for symbolic shape (#2317)
This commit is contained in:
Родитель
97ca4031f3
Коммит
5cb729ec48
|
@ -253,12 +253,12 @@ class StorageAllocator : public StorageAllocaBaseVisitor {
|
|||
size_t size = 1;
|
||||
for (IndexExpr dim : ttype->shape) {
|
||||
const int64_t* pval = as_const_int(dim);
|
||||
CHECK_GE(*pval, 0) <<
|
||||
"can not allocate memory for tensor with negative shape" <<
|
||||
*pval;
|
||||
CHECK(pval != nullptr)
|
||||
<< "Cannot allocate memory symbolic tensor shape "
|
||||
<< ttype->shape;
|
||||
CHECK_GE(*pval, 0)
|
||||
<< "Cannot allocate memory for tensor with negative shape"
|
||||
<< *pval;
|
||||
size *= static_cast<size_t>(pval[0]);
|
||||
}
|
||||
size *= DivRoundUp(ttype->dtype.bits() * ttype->dtype.lanes(), 8);
|
||||
|
|
Загрузка…
Ссылка в новой задаче