From 4c28a2f48552c80aa549ddab56d8543730fa4247 Mon Sep 17 00:00:00 2001 From: shenwei41 Date: Mon, 20 Jul 2020 20:32:30 +0800 Subject: [PATCH] Alarm modification --- mindspore/ccsrc/minddata/dataset/api/datasets.cc | 2 +- mindspore/ccsrc/minddata/dataset/api/de_pipeline.cc | 8 ++++---- .../minddata/dataset/engine/cache/cache_request.h | 13 +++++++++++++ .../minddata/dataset/engine/opt/post/repeat_pass.h | 3 +++ .../minddata/dataset/engine/opt/pre/cache_pass.cc | 4 ++-- .../minddata/dataset/engine/opt/pre/cache_pass.h | 3 +++ .../dataset/engine/opt/pre/cache_transform_pass.h | 3 +++ .../minddata/dataset/kernels/image/image_utils.cc | 4 ++-- 8 files changed, 31 insertions(+), 9 deletions(-) diff --git a/mindspore/ccsrc/minddata/dataset/api/datasets.cc b/mindspore/ccsrc/minddata/dataset/api/datasets.cc index 3072a62dc9..f4ed295940 100644 --- a/mindspore/ccsrc/minddata/dataset/api/datasets.cc +++ b/mindspore/ccsrc/minddata/dataset/api/datasets.cc @@ -186,7 +186,7 @@ std::shared_ptr Dataset::Project(const std::vector // Helper function to create default RandomSampler. std::shared_ptr CreateDefaultSampler() { - int32_t num_samples = 0; // 0 means to sample all ids. + const int32_t num_samples = 0; // 0 means to sample all ids. bool replacement = false; return std::make_shared(replacement, num_samples); } diff --git a/mindspore/ccsrc/minddata/dataset/api/de_pipeline.cc b/mindspore/ccsrc/minddata/dataset/api/de_pipeline.cc index 5c69cb0b6a..c44e956b3e 100644 --- a/mindspore/ccsrc/minddata/dataset/api/de_pipeline.cc +++ b/mindspore/ccsrc/minddata/dataset/api/de_pipeline.cc @@ -1157,8 +1157,8 @@ Status DEPipeline::ParseTFReaderOp(const py::dict &args, std::shared_ptrSetSampler(std::move(sampler)); } else if (cache_client) { - int64_t num_samples = 0; - int64_t start_index = 0; + const int64_t num_samples = 0; + const int64_t start_index = 0; sampler = std::make_shared(num_samples, start_index); (void)builder->SetSampler(std::move(sampler)); } @@ -1511,8 +1511,8 @@ Status DEPipeline::ParseRandomDataOp(const py::dict &args, std::shared_ptr(num_samples, start_index); (void)builder.SetSampler(std::move(sampler)); } diff --git a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_request.h b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_request.h index ca44f5fa5a..7e932af622 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_request.h +++ b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_request.h @@ -111,6 +111,7 @@ class BatchFetchRequest : public BaseRequest { friend class CacheService; BatchFetchRequest(connection_id_type connection_id, const std::vector &row_id) : BaseRequest(connection_id, RequestType::kBatchFetchRows), row_id_(row_id) {} + ~BatchFetchRequest() = default; Status RestoreRows(TensorTable *out); private: @@ -130,6 +131,8 @@ class CreationCacheRequest : public BaseRequest { CreateCacheFlag flag = CreateCacheFlag::kNone) : BaseRequest(connection_id, RequestType::kCreateCache), cache_mem_sz(cache_mem_sz), flag_(flag) {} + ~CreationCacheRequest() = default; + std::string cookie() const { return cookie_; } private: @@ -142,6 +145,8 @@ class PurgeCacheRequest : public BaseRequest { public: friend class CacheServer; explicit PurgeCacheRequest(connection_id_type connection_id) : BaseRequest(connection_id, RequestType::kPurgeCache) {} + + ~PurgeCacheRequest() = default; }; /// \brief Request to destroy a cache class DestroyCacheRequest : public BaseRequest { @@ -149,6 +154,9 @@ class DestroyCacheRequest : public BaseRequest { friend class CacheServer; explicit DestroyCacheRequest(connection_id_type connection_id) : BaseRequest(connection_id, RequestType::kDestroyCache) {} + + /// \brief Destructor + ~DestroyCacheRequest() = default; }; /// \brief Obtain the statistics of the current connection class GetStatRequest : public BaseRequest { @@ -156,6 +164,9 @@ class GetStatRequest : public BaseRequest { friend class CacheServer; friend class CacheService; explicit GetStatRequest(connection_id_type connection_id) : BaseRequest(connection_id, RequestType::kGetStat) {} + + ~GetStatRequest() = default; + row_id_type GetMinRowId() const { auto *msg = flatbuffers::GetRoot(mem_.GetPointer()); return msg->min_row_id(); @@ -217,6 +228,8 @@ class BuildPhaseDoneRequest : public BaseRequest { BuildPhaseDoneRequest(connection_id_type connection_id, const std::string &cookie) : BaseRequest(connection_id, RequestType::kBuildPhaseDone), cookie_(cookie) {} + ~BuildPhaseDoneRequest() = default; + private: std::string cookie_; }; diff --git a/mindspore/ccsrc/minddata/dataset/engine/opt/post/repeat_pass.h b/mindspore/ccsrc/minddata/dataset/engine/opt/post/repeat_pass.h index 1b37dd95f7..67a243f44c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/opt/post/repeat_pass.h +++ b/mindspore/ccsrc/minddata/dataset/engine/opt/post/repeat_pass.h @@ -35,6 +35,9 @@ class RepeatPass : public NodePass { /// \brief Constructor RepeatPass(); + /// \brief Destructor + ~RepeatPass() = default; + /// \brief Identifies the subtree below this node as being in a repeated path of the tree. /// \param[in] node The node being visited /// \param[inout] modified Indicator if the node was changed at all diff --git a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.cc b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.cc index 09b5f14a17..f4453f25b1 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.cc @@ -67,8 +67,8 @@ Status CachePass::RunOnNode(std::shared_ptr node, bool *modified) { MS_LOG(INFO) << "Cache transform pass: Set up cache sampler from non-mappable leaf."; } else { // We're a cache op but no sampler was saved from leaf, so create a default sampler - int64_t num_samples = 0; - int64_t start_index = 0; + const int64_t num_samples = 0; + const int64_t start_index = 0; sampler_ = std::make_shared(num_samples, start_index); node->SetSampler(std::move(sampler_)); MS_LOG(INFO) << "Cache transform pass: Creating default sequential sampler for cache op."; diff --git a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.h b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.h index 326b35ec34..c08db89563 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.h +++ b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_pass.h @@ -36,6 +36,9 @@ class CachePass : public NodePass { /// \param[in] transform_pass Raw pointer back to controlling tree pass explicit CachePass(CacheTransformPass *transform_pass); + /// \brief Destructor + ~CachePass() = default; + /// \brief Identifies the subtree below this node as a cached descendant tree. /// \param[in] node The node being visited /// \param[inout] modified Indicator if the node was changed at all diff --git a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_transform_pass.h b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_transform_pass.h index 692b5421d1..05efb5b126 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_transform_pass.h +++ b/mindspore/ccsrc/minddata/dataset/engine/opt/pre/cache_transform_pass.h @@ -37,6 +37,9 @@ class CacheTransformPass : public TreePass { /// \brief Constructor CacheTransformPass(); + /// \brief Destructor + ~CacheTransformPass() = default; + /// \brief Runs a cache_pass first to set up the transformation nodes, and then drives any of these transformations /// \param[inout] tree The tree to operate on. /// \param[inout] Indicate of the tree was modified. diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc index dac076a5f4..c277cf76d6 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/image_utils.cc @@ -664,8 +664,8 @@ Status AutoContrast(const std::shared_ptr &input, std::shared_ptr(i * scale + offset); ix = std::max(ix, 0);