From 3e6e35d749527749f262b7c6e007c882ff93176c Mon Sep 17 00:00:00 2001 From: Cathy Wong Date: Wed, 3 Feb 2021 21:07:04 -0500 Subject: [PATCH] dataset: delete minddata/dataset/include/status.h --- cmake/package.cmake | 1 - .../ccsrc/minddata/dataset/core/de_tensor.h | 4 +- .../ccsrc/minddata/dataset/include/iterator.h | 4 +- .../ccsrc/minddata/dataset/include/samplers.h | 2 +- .../ccsrc/minddata/dataset/include/status.h | 105 ------------------ .../ccsrc/minddata/dataset/include/tensor.h | 4 +- .../ccsrc/minddata/dataset/include/text.h | 4 +- .../minddata/dataset/include/transforms.h | 4 +- .../ccsrc/minddata/dataset/include/vision.h | 5 +- .../minddata/dataset/include/vision_lite.h | 4 +- tests/ut/cpp/dataset/build_vocab_test.cc | 5 +- .../c_api_text_sentence_piece_vocab_test.cc | 4 +- tests/ut/cpp/dataset/c_api_text_test.cc | 4 +- tests/ut/cpp/dataset/c_api_text_vocab_test.cc | 4 +- tests/ut/cpp/dataset/common/common.h | 4 +- 15 files changed, 26 insertions(+), 132 deletions(-) delete mode 100644 mindspore/ccsrc/minddata/dataset/include/status.h diff --git a/cmake/package.cmake b/cmake/package.cmake index 87b30bffa86..37838d7f953 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -323,7 +323,6 @@ install( ## Public header files for minddata install( FILES ${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/constants.h - ${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/status.h ${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/transforms.h ${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/vision.h ${CMAKE_SOURCE_DIR}/mindspore/ccsrc/minddata/dataset/include/vision_lite.h diff --git a/mindspore/ccsrc/minddata/dataset/core/de_tensor.h b/mindspore/ccsrc/minddata/dataset/core/de_tensor.h index be3eb68e2f8..2fe575123f9 100644 --- a/mindspore/ccsrc/minddata/dataset/core/de_tensor.h +++ b/mindspore/ccsrc/minddata/dataset/core/de_tensor.h @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2020-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,9 @@ #include #include #include +#include "include/api/status.h" #include "include/api/types.h" #include "mindspore/core/ir/api_tensor_impl.h" -#include "minddata/dataset/include/status.h" #include "minddata/dataset/include/tensor.h" namespace mindspore { diff --git a/mindspore/ccsrc/minddata/dataset/include/iterator.h b/mindspore/ccsrc/minddata/dataset/include/iterator.h index dbd6ddd0fa2..28044959d4f 100644 --- a/mindspore/ccsrc/minddata/dataset/include/iterator.h +++ b/mindspore/ccsrc/minddata/dataset/include/iterator.h @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2020-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ #include #include #include -#include "minddata/dataset/include/status.h" +#include "include/api/status.h" namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/include/samplers.h b/mindspore/ccsrc/minddata/dataset/include/samplers.h index 50d111521fd..0c79d9b2a81 100644 --- a/mindspore/ccsrc/minddata/dataset/include/samplers.h +++ b/mindspore/ccsrc/minddata/dataset/include/samplers.h @@ -22,7 +22,7 @@ #include #include -#include "minddata/dataset/include/status.h" +#include "include/api/status.h" #ifndef ENABLE_ANDROID #include "minddata/mindrecord/include/shard_column.h" #include "minddata/mindrecord/include/shard_error.h" diff --git a/mindspore/ccsrc/minddata/dataset/include/status.h b/mindspore/ccsrc/minddata/dataset/include/status.h deleted file mode 100644 index e5896687d22..00000000000 --- a/mindspore/ccsrc/minddata/dataset/include/status.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright 2019 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_STATUS_H_ -#define MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_STATUS_H_ - -#if defined(__GNUC__) || defined(__clang__) -#define DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) -#define DEPRECATED __declspec(deprecated) -#else -#pragma message("WARNING: You need to implement DEPRECATED for this compiler") -#define DEPRECATED -#endif - -#include -#include -#include - -#include "include/api/status.h" - -namespace mindspore { -namespace dataset { -#define RETURN_IF_NOT_OK(_s) \ - do { \ - Status __rc = (_s); \ - if (__rc.IsError()) { \ - return __rc; \ - } \ - } while (false) - -#define RETURN_STATUS_UNEXPECTED(_e) \ - do { \ - return Status(StatusCode::kMDUnexpectedError, __LINE__, __FILE__, _e); \ - } while (false) - -#define CHECK_FAIL_RETURN_UNEXPECTED(_condition, _e) \ - do { \ - if (!(_condition)) { \ - return Status(StatusCode::kMDUnexpectedError, __LINE__, __FILE__, _e); \ - } \ - } while (false) - -#define CHECK_FAIL_RETURN_SYNTAX_ERROR(_condition, _e) \ - do { \ - if (!(_condition)) { \ - return Status(StatusCode::kMDSyntaxError, __LINE__, __FILE__, _e); \ - } \ - } while (false) - -#define CHECK_FAIL_RETURN_SYNTAX_ERROR(_condition, _e) \ - do { \ - if (!(_condition)) { \ - return Status(StatusCode::kMDSyntaxError, __LINE__, __FILE__, _e); \ - } \ - } while (false) - -#define RETURN_UNEXPECTED_IF_NULL(_ptr) \ - do { \ - if ((_ptr) == nullptr) { \ - std::string err_msg = "The pointer[" + std::string(#_ptr) + "] is null."; \ - RETURN_STATUS_UNEXPECTED(err_msg); \ - } \ - } while (false) - -#define RETURN_OK_IF_TRUE(_condition) \ - do { \ - if (_condition) { \ - return Status::OK(); \ - } \ - } while (false) - -#define RETURN_STATUS_SYNTAX_ERROR(_e) \ - do { \ - return Status(StatusCode::kMDSyntaxError, __LINE__, __FILE__, _e); \ - } while (false) - -#define RETURN_SECOND_IF_ERROR(_s, _r) \ - do { \ - Status __rc = (_s); \ - if (__rc.IsError()) { \ - MS_LOG(ERROR) << __rc; \ - return _r; \ - } \ - } while (false) - -#if !defined(_WIN32) && !defined(_WIN64) -const float MAX_MEMORY_USAGE_THRESHOLD = 0.95; -float GetMemoryUsage(); -#endif -} // namespace dataset -} // namespace mindspore -#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_STATUS_H_ diff --git a/mindspore/ccsrc/minddata/dataset/include/tensor.h b/mindspore/ccsrc/minddata/dataset/include/tensor.h index 2113036ae5d..c3e592ee6bf 100644 --- a/mindspore/ccsrc/minddata/dataset/include/tensor.h +++ b/mindspore/ccsrc/minddata/dataset/include/tensor.h @@ -1,5 +1,5 @@ /** - * Copyright 2019 Huawei Technologies Co., Ltd + * Copyright 2019-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,11 +38,11 @@ #endif #include "utils/ms_utils.h" +#include "include/api/status.h" #include "minddata/dataset/core/constants.h" #include "minddata/dataset/core/data_type.h" #include "minddata/dataset/core/tensor_shape.h" #include "minddata/dataset/core/de_tensor.h" -#include "minddata/dataset/util/status.h" #ifndef ENABLE_ANDROID #include "proto/example.pb.h" #endif diff --git a/mindspore/ccsrc/minddata/dataset/include/text.h b/mindspore/ccsrc/minddata/dataset/include/text.h index 146fb5e799f..408f101560d 100644 --- a/mindspore/ccsrc/minddata/dataset/include/text.h +++ b/mindspore/ccsrc/minddata/dataset/include/text.h @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2020-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ #include #include +#include "include/api/status.h" #include "minddata/dataset/include/constants.h" -#include "minddata/dataset/include/status.h" #include "minddata/dataset/include/transforms.h" namespace mindspore { diff --git a/mindspore/ccsrc/minddata/dataset/include/transforms.h b/mindspore/ccsrc/minddata/dataset/include/transforms.h index 08db9b045a3..16b384895f8 100644 --- a/mindspore/ccsrc/minddata/dataset/include/transforms.h +++ b/mindspore/ccsrc/minddata/dataset/include/transforms.h @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2020-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,8 @@ #include #include +#include "include/api/status.h" #include "minddata/dataset/include/constants.h" -#include "minddata/dataset/include/status.h" #include "minddata/dataset/include/tensor.h" #ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ diff --git a/mindspore/ccsrc/minddata/dataset/include/vision.h b/mindspore/ccsrc/minddata/dataset/include/vision.h index 4775631b4b2..52d823913b4 100644 --- a/mindspore/ccsrc/minddata/dataset/include/vision.h +++ b/mindspore/ccsrc/minddata/dataset/include/vision.h @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2020-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,11 @@ #include #include +#include "include/api/status.h" #include "minddata/dataset/include/constants.h" #include "minddata/dataset/include/transforms.h" #include "minddata/dataset/include/vision_lite.h" -#include "minddata/dataset/include/status.h" + namespace mindspore { namespace dataset { diff --git a/mindspore/ccsrc/minddata/dataset/include/vision_lite.h b/mindspore/ccsrc/minddata/dataset/include/vision_lite.h index d4312406679..8713df7bd89 100644 --- a/mindspore/ccsrc/minddata/dataset/include/vision_lite.h +++ b/mindspore/ccsrc/minddata/dataset/include/vision_lite.h @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2020-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,9 +22,9 @@ #include #include #include +#include "include/api/status.h" #include "minddata/dataset/include/constants.h" #include "minddata/dataset/include/transforms.h" -#include "minddata/dataset/include/status.h" namespace mindspore { namespace dataset { diff --git a/tests/ut/cpp/dataset/build_vocab_test.cc b/tests/ut/cpp/dataset/build_vocab_test.cc index bcb4d436492..88030982c8d 100644 --- a/tests/ut/cpp/dataset/build_vocab_test.cc +++ b/tests/ut/cpp/dataset/build_vocab_test.cc @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2020-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,12 +20,11 @@ #include #include "common/common.h" +#include "include/api/status.h" #include "minddata/dataset/include/datasets.h" -#include "minddata/dataset/include/status.h" #include "minddata/dataset/text/vocab.h" using mindspore::dataset::Tensor; -using mindspore::Status; using mindspore::dataset::Vocab; class MindDataTestVocab : public UT::DatasetOpTesting { diff --git a/tests/ut/cpp/dataset/c_api_text_sentence_piece_vocab_test.cc b/tests/ut/cpp/dataset/c_api_text_sentence_piece_vocab_test.cc index 9a16f39877a..2de7bbac5ce 100644 --- a/tests/ut/cpp/dataset/c_api_text_sentence_piece_vocab_test.cc +++ b/tests/ut/cpp/dataset/c_api_text_sentence_piece_vocab_test.cc @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2020-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ #include #include "common/common.h" +#include "include/api/status.h" #include "minddata/dataset/include/constants.h" #include "minddata/dataset/include/datasets.h" -#include "minddata/dataset/include/status.h" #include "minddata/dataset/include/text.h" #include "minddata/dataset/include/transforms.h" #include "minddata/dataset/text/sentence_piece_vocab.h" diff --git a/tests/ut/cpp/dataset/c_api_text_test.cc b/tests/ut/cpp/dataset/c_api_text_test.cc index e50419e23b2..80f620b6c26 100644 --- a/tests/ut/cpp/dataset/c_api_text_test.cc +++ b/tests/ut/cpp/dataset/c_api_text_test.cc @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2020-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ #include #include "common/common.h" +#include "include/api/status.h" #include "minddata/dataset/include/config.h" #include "minddata/dataset/include/datasets.h" -#include "minddata/dataset/include/status.h" #include "minddata/dataset/include/text.h" #include "minddata/dataset/include/transforms.h" #include "minddata/dataset/text/vocab.h" diff --git a/tests/ut/cpp/dataset/c_api_text_vocab_test.cc b/tests/ut/cpp/dataset/c_api_text_vocab_test.cc index f54ed381f69..57ac2ac4f01 100644 --- a/tests/ut/cpp/dataset/c_api_text_vocab_test.cc +++ b/tests/ut/cpp/dataset/c_api_text_vocab_test.cc @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2020-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ #include #include "common/common.h" +#include "include/api/status.h" #include "minddata/dataset/include/datasets.h" -#include "minddata/dataset/include/status.h" #include "minddata/dataset/include/text.h" #include "minddata/dataset/include/transforms.h" #include "minddata/dataset/text/vocab.h" diff --git a/tests/ut/cpp/dataset/common/common.h b/tests/ut/cpp/dataset/common/common.h index db8c8130c08..f9dcb0abed0 100644 --- a/tests/ut/cpp/dataset/common/common.h +++ b/tests/ut/cpp/dataset/common/common.h @@ -1,5 +1,5 @@ /** - * Copyright 2019 Huawei Technologies Co., Ltd + * Copyright 2019-2021 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ #define TESTS_DATASET_UT_CORE_COMMON_DE_UT_COMMON_H_ #include "gtest/gtest.h" -#include "minddata/dataset/util/status.h" +#include "include/api/status.h" #include "utils/log_adapter.h" using mindspore::Status;