!6963 [Data]add input param check

Merge pull request !6963 from xulei/lite_test0905
pull/6963/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 051928b867

@ -294,6 +294,9 @@ static bool ConvertRGBAToGRAY(const unsigned char *data, LDataType data_type, in
}
bool InitFromPixel(const unsigned char *data, LPixelType pixel_type, LDataType data_type, int w, int h, LiteMat &m) {
if (data == nullptr) {
return false;
}
if (w <= 0 || h <= 0) {
return false;
}
@ -517,6 +520,9 @@ bool Pad(const LiteMat &src, LiteMat &dst, int top, int bottom, int left, int ri
if (top <= 0 || bottom <= 0 || left <= 0 || right <= 0) {
return false;
}
if (src.IsEmpty()) {
return false;
}
if (pad_type == PADD_BORDER_CONSTANT && src.data_type_ == LDataType::FLOAT32) {
PadWithConstant<float>(src, dst, top, bottom, left, right, pad_type, fill_b_or_gray, fill_g, fill_r);
} else if (pad_type == PADD_BORDER_CONSTANT && src.data_type_ == LDataType::UINT8) {

Loading…
Cancel
Save