forked from mindspore-Ecosystem/mindspore
!29307 [MSLITE][CPU] fuzz test problem bugfix, fix arithmetic_self op checkspec
Merge pull request !29307 from Greatpan/fuzz_problem
This commit is contained in:
commit
764c70671f
|
@ -61,9 +61,18 @@
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define CHECK_NOT_EQUAL_RETURN(size1, size2) \
|
||||
do { \
|
||||
if ((size1) != (size2)) { \
|
||||
MS_LOG(ERROR) << #size1 << " must be equal to " << #size2; \
|
||||
return mindspore::lite::RET_ERROR; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
#define CHECK_NULL_RETURN(ptr)
|
||||
#define CHECK_NULL_RETURN_VOID(ptr)
|
||||
#define CHECK_LESS_RETURN(size1, size2)
|
||||
#define CHECK_NOT_EQUAL_RETURN(size1, size2)
|
||||
#endif
|
||||
#endif // MINDSPORE_LITE_SRC_COMMON_LOG_UTIL_H_
|
||||
|
|
|
@ -60,8 +60,8 @@ ArithmeticSelfBoolFunc ArithmeticSelfCPUKernel::GetArithmeticSelfBoolFun(int pri
|
|||
}
|
||||
|
||||
int ArithmeticSelfCPUKernel::Prepare() {
|
||||
CHECK_LESS_RETURN(in_tensors_.size(), 1);
|
||||
CHECK_LESS_RETURN(out_tensors_.size(), 1);
|
||||
CHECK_NOT_EQUAL_RETURN(in_tensors_.size(), 1);
|
||||
CHECK_NOT_EQUAL_RETURN(out_tensors_.size(), 1);
|
||||
if (!InferShapeDone()) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
|
|
@ -148,6 +148,10 @@ int CopyConstTensorData(const std::vector<Tensor *> &tensors, int op_type) {
|
|||
}
|
||||
for (auto *tensor : tensors) {
|
||||
// only copy non-copied const tensor
|
||||
if (!tensor->IsConst() && tensor->data() != nullptr) {
|
||||
MS_LOG(ERROR) << "Illegitimate tensor : " << tensor->tensor_name();
|
||||
continue;
|
||||
}
|
||||
if (!tensor->IsConst() || tensor->own_data()) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue