diff --git a/mindspore/ccsrc/minddata/dataset/kernels/data/data_utils.cc b/mindspore/ccsrc/minddata/dataset/kernels/data/data_utils.cc index 33427792d8..0980116a25 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/data/data_utils.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/data/data_utils.cc @@ -386,7 +386,9 @@ Status PadEnd(const std::shared_ptr &src, std::shared_ptr *dst, } } CHECK_FAIL_RETURN_UNEXPECTED(src->type().IsNumeric() == pad_val->type().IsNumeric(), - "PadEnd: Source and pad_value are not of the same type."); + "PadEnd: pad_value and item of dataset are not of the same type, type of pad_value is:" + + pad_val->type().ToString() + + ", and type of dataset item is:" + src->type().ToString() + "."); if (pad_val->type().IsNumeric()) { std::shared_ptr float_pad_value; RETURN_IF_NOT_OK(TypeCast(pad_val, &float_pad_value, DataType(DataType::DE_FLOAT32))); diff --git a/mindspore/core/utils/status.cc b/mindspore/core/utils/status.cc index 4ff085d172..ba348dd2e9 100644 --- a/mindspore/core/utils/status.cc +++ b/mindspore/core/utils/status.cc @@ -58,7 +58,11 @@ Status::Status(enum StatusCode code, int line_of_code, const char *file_name, co std::ostringstream ss; #ifndef ENABLE_ANDROID +#ifdef DEBUG ss << "Thread ID " << std::this_thread::get_id() << " " << CodeAsString(code) << ". "; +#else + ss << CodeAsString(code) << ". "; +#endif if (!data_->err_description.empty()) { ss << data_->err_description; } @@ -168,7 +172,11 @@ std::vector Status::SetErrDescription(const std::vector &err_descrip data_->err_description = CharToString(err_description); std::ostringstream ss; #ifndef ENABLE_ANDROID +#ifdef DEBUG ss << "Thread ID " << std::this_thread::get_id() << " " << CodeAsString(data_->status_code) << ". "; +#else + ss << CodeAsString(data_->status_code) << ". "; +#endif if (!data_->err_description.empty()) { ss << data_->err_description; } diff --git a/mindspore/dataset/transforms/validators.py b/mindspore/dataset/transforms/validators.py index a82748f722..d36378ecef 100644 --- a/mindspore/dataset/transforms/validators.py +++ b/mindspore/dataset/transforms/validators.py @@ -166,7 +166,7 @@ def check_pad_end(method): if pad_value is not None: type_check(pad_value, (str, float, bool, int, bytes), "pad_value") - type_check(pad_shape, (list,), "pad_end") + type_check(pad_shape, (list,), "pad_shape") for dim in pad_shape: if dim is not None: diff --git a/tests/ut/python/dataset/test_pad_end_op.py b/tests/ut/python/dataset/test_pad_end_op.py index e3afde005f..d1b0c08189 100644 --- a/tests/ut/python/dataset/test_pad_end_op.py +++ b/tests/ut/python/dataset/test_pad_end_op.py @@ -51,11 +51,11 @@ def test_pad_end_str(): def test_pad_end_exceptions(): with pytest.raises(RuntimeError) as info: pad_compare([1, 2], [3], "-1", []) - assert "Source and pad_value are not of the same type." in str(info.value) + assert "pad_value and item of dataset are not of the same type" in str(info.value) with pytest.raises(RuntimeError) as info: pad_compare([b"1", b"2", b"3", b"4", b"5"], [2], 1, []) - assert "Source and pad_value are not of the same type." in str(info.value) + assert "pad_value and item of dataset are not of the same type" in str(info.value) with pytest.raises(TypeError) as info: pad_compare([3, 4, 5], ["2"], 1, []) @@ -63,7 +63,7 @@ def test_pad_end_exceptions(): with pytest.raises(TypeError) as info: pad_compare([1, 2], 3, -1, [1, 2, -1]) - assert "Argument pad_end with value 3 is not of type []" in str(info.value) + assert "Argument pad_shape with value 3 is not of type []" in str(info.value) if __name__ == "__main__":