From 595b7a782faf7313295ea774e7479b1a9448d590 Mon Sep 17 00:00:00 2001 From: luoyang Date: Thu, 17 Dec 2020 16:33:25 +0800 Subject: [PATCH] [MD] Fix Decode doc & RandomNode log --- .../dataset/engine/ir/datasetops/source/random_node.cc | 2 +- mindspore/dataset/vision/c_transforms.py | 3 ++- tests/ut/python/dataset/test_eager_vision.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.cc b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.cc index c63f7bcc3c..70910746dc 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/ir/datasetops/source/random_node.cc @@ -54,7 +54,7 @@ Status RandomNode::ValidateParams() { // allow total_rows == 0 for now because RandomOp would generate a random row when it gets a 0 CHECK_FAIL_RETURN_UNEXPECTED(total_rows_ == 0 || total_rows_ >= num_workers_, - "RandomNode needs total_rows < num_workers. total_rows=" + std::to_string(total_rows_) + + "RandomNode needs total_rows >= num_workers, total_rows=" + std::to_string(total_rows_) + ", num_workers=" + std::to_string(num_workers_) + "."); return Status::OK(); diff --git a/mindspore/dataset/vision/c_transforms.py b/mindspore/dataset/vision/c_transforms.py index cbfecf68ba..ac84b4ff68 100644 --- a/mindspore/dataset/vision/c_transforms.py +++ b/mindspore/dataset/vision/c_transforms.py @@ -163,6 +163,7 @@ class Decode(cde.DecodeOp): Args: rgb (bool, optional): Mode of decoding input image (default=True). + If True means format of decoded image is RGB else BGR(deprecated). Examples: >>> import mindspore.dataset.vision.c_transforms as c_vision @@ -186,7 +187,7 @@ class Decode(cde.DecodeOp): img (NumPy), Decoded image. """ if not isinstance(img, np.ndarray) or img.ndim != 1 or img.dtype.type is np.str_: - raise TypeError("Input should be a 1-D NumPy with integer type, got {}.".format(type(img))) + raise TypeError("Input should be an encoded image with 1-D NumPy type, got {}.".format(type(img))) decode = cde.Execute(cde.DecodeOp(self.rgb)) img = decode(cde.Tensor(np.asarray(img))) return img.as_array() diff --git a/tests/ut/python/dataset/test_eager_vision.py b/tests/ut/python/dataset/test_eager_vision.py index 3f76f67efa..c83f78bca2 100644 --- a/tests/ut/python/dataset/test_eager_vision.py +++ b/tests/ut/python/dataset/test_eager_vision.py @@ -95,14 +95,14 @@ def test_eager_exceptions(): img = C.Decode()(img) assert False except TypeError as e: - assert "Input should be a 1-D NumPy with integer type" in str(e) + assert "Input should be an encoded image with 1-D NumPy type" in str(e) try: img = np.array(["a", "b", "c"]) img = C.Decode()(img) assert False except TypeError as e: - assert "Input should be a 1-D NumPy with integer type" in str(e) + assert "Input should be an encoded image with 1-D NumPy type" in str(e) try: img = cv2.imread("../data/dataset/apple.jpg")