diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/warp_affine.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/warp_affine.cc index f7a59b9d30..293c2320a0 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/warp_affine.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/warp_affine.cc @@ -355,6 +355,10 @@ static void Remap(const LiteMat &src, LiteMat &dst, LiteMat &map1, const LiteMat bool WarpAffineBilinear(const LiteMat &src, LiteMat &dst, const LiteMat &M, int dst_w, int dst_h, // NOLINT PaddBorderType borderType, std::vector &borderValue) { // NOLINT + if (dst_w <= 0 || dst_h <= 0) { + return false; + } + if (!(M.height_ == 2 && M.width_ == 3)) { return false; } @@ -471,6 +475,9 @@ static void PerspectiveInvert(double *src, double *dst) { bool WarpPerspectiveBilinear(const LiteMat &src, LiteMat &dst, const LiteMat &M, int dst_w, int dst_h, // NOLINT PaddBorderType borderType, std::vector &borderValue) { // NOLINT + if (dst_w <= 0 || dst_h <= 0) { + return false; + } if (!(M.height_ == 3 && M.width_ == 3)) { return false; } diff --git a/mindspore/dataset/transforms/validators.py b/mindspore/dataset/transforms/validators.py index f3ae5cea8a..51353a82c7 100644 --- a/mindspore/dataset/transforms/validators.py +++ b/mindspore/dataset/transforms/validators.py @@ -60,7 +60,7 @@ def check_one_hot_op(method): @wraps(method) def new_method(self, *args, **kwargs): [num_classes, smoothing_rate], _ = parse_user_args(method, *args, **kwargs) - + type_check(smoothing_rate, (int, float), "smoothing_rate") type_check(num_classes, (int,), "num_classes") check_positive(num_classes) diff --git a/mindspore/dataset/vision/validators.py b/mindspore/dataset/vision/validators.py index f3ee5d3ba7..10459ceb12 100644 --- a/mindspore/dataset/vision/validators.py +++ b/mindspore/dataset/vision/validators.py @@ -44,6 +44,8 @@ def check_cut_mix_batch_c(method): def new_method(self, *args, **kwargs): [image_batch_format, alpha, prob], _ = parse_user_args(method, *args, **kwargs) type_check(image_batch_format, (ImageBatchFormat,), "image_batch_format") + type_check(alpha, (int, float), "alpha") + type_check(prob, (int, float), "prob") check_pos_float32(alpha) check_positive(alpha, "alpha") check_value(prob, [0, 1], "prob") @@ -70,6 +72,7 @@ def check_mix_up_batch_c(method): @wraps(method) def new_method(self, *args, **kwargs): [alpha], _ = parse_user_args(method, *args, **kwargs) + type_check(alpha, (int, float), "alpha") check_positive(alpha, "alpha") check_pos_float32(alpha) @@ -463,11 +466,11 @@ def check_mix_up(method): @wraps(method) def new_method(self, *args, **kwargs): [batch_size, alpha, is_single], _ = parse_user_args(method, *args, **kwargs) - + type_check(is_single, (bool,), "is_single") + type_check(batch_size, (int,), "batch_size") + type_check(alpha, (int, float), "alpha") check_value(batch_size, (1, FLOAT_MAX_INTEGER)) check_positive(alpha, "alpha") - type_check(is_single, (bool,), "is_single") - return method(self, *args, **kwargs) return new_method diff --git a/tests/ut/cpp/dataset/README.md b/tests/ut/cpp/dataset/README.md index c7662d4802..46cd3cbc7c 100644 --- a/tests/ut/cpp/dataset/README.md +++ b/tests/ut/cpp/dataset/README.md @@ -1,3 +1,4 @@ ### Introduce of data + All of data used in this folder created by Huawei Technologies Co. diff --git a/tests/ut/python/dataset/README.md b/tests/ut/python/dataset/README.md index 582d344b59..1cdbbc801e 100644 --- a/tests/ut/python/dataset/README.md +++ b/tests/ut/python/dataset/README.md @@ -1,7 +1,9 @@ ## DE Dataset Ops Test (Python) -#### Environment +### Environment + Python3.7 (PyCharm IDE is recommended) ### Introduce of data + All of data used in this folder created by Huawei Technologies Co.