!29043 [MSLITE] matmul bias tensor data invalid

Merge pull request !29043 from ling/r1.6
This commit is contained in:
i-robot 2022-01-14 02:35:53 +00:00 committed by Gitee
commit c54e7babfb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 4 additions and 0 deletions

View File

@ -123,6 +123,10 @@ int MatmulFp32BaseCPUKernel::InitBiasData() {
MS_LOG(ERROR) << "bias_tensor invalid";
return RET_ERROR;
}
if (bias_tensor->data() == nullptr) {
MS_LOG(ERROR) << "bias_tensor data invalid";
return RET_ERROR;
}
auto bias_num = static_cast<size_t>(bias_tensor->ElementsNum());
MS_CHECK_TRUE_RET(bias_num > 0, RET_ERROR);
if (bias_num == 1) {