From a4e7a75891ed654445ce646bf45067417f528c1f Mon Sep 17 00:00:00 2001 From: shenwei41 Date: Thu, 20 Aug 2020 14:58:41 +0800 Subject: [PATCH] Modify alarm --- mindspore/ccsrc/debug/debugger/debugger.cc | 6 +++--- mindspore/ccsrc/minddata/dataset/api/datasets.cc | 1 + mindspore/ccsrc/minddata/dataset/engine/gnn/graph_loader.h | 3 +-- .../ccsrc/minddata/dataset/kernels/image/cutmix_batch_op.cc | 3 +-- .../ccsrc/minddata/dataset/kernels/image/random_color_op.h | 2 ++ 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/mindspore/ccsrc/debug/debugger/debugger.cc b/mindspore/ccsrc/debug/debugger/debugger.cc index 60e07046cb7..17a181fa488 100644 --- a/mindspore/ccsrc/debug/debugger/debugger.cc +++ b/mindspore/ccsrc/debug/debugger/debugger.cc @@ -149,7 +149,7 @@ void Debugger::EnableDebugger() { last_overflow_bin_ = 0; DIR *d; d = opendir(overflow_bin_path_.c_str()); - if (d) { + if (d != nullptr) { struct dirent *dir; while ((dir = readdir(d)) != NULL) { if (dir->d_type == DT_REG) { @@ -718,9 +718,9 @@ std::vector Debugger::CheckOpOverflow() { std::vector bin_list; std::vector op_names; DIR *d; - struct dirent *dir; + struct dirent *dir = nullptr; d = opendir(overflow_bin_path_.c_str()); - if (d) { + if (d != nullptr) { while ((dir = readdir(d)) != NULL) { if (dir->d_type == DT_REG) { std::string file_path = overflow_bin_path_; diff --git a/mindspore/ccsrc/minddata/dataset/api/datasets.cc b/mindspore/ccsrc/minddata/dataset/api/datasets.cc index 9dc1537684e..97ce2820dae 100644 --- a/mindspore/ccsrc/minddata/dataset/api/datasets.cc +++ b/mindspore/ccsrc/minddata/dataset/api/datasets.cc @@ -609,6 +609,7 @@ Status ComputeShuffleSize(int64_t num_files, int64_t num_devices, int64_t num_ro } // get the average per file + CHECK_FAIL_RETURN_UNEXPECTED(num_files != 0, "The size of dataset_files must greater than 0."); avg_rows_per_file = num_rows / num_files; *shuffle_size = std::max(avg_rows_per_file * average_files_multiplier, shuffle_max); diff --git a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_loader.h b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_loader.h index 58320861f2d..7b397547fb5 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_loader.h +++ b/mindspore/ccsrc/minddata/dataset/engine/gnn/graph_loader.h @@ -35,6 +35,7 @@ #include "minddata/dataset/engine/gnn/node.h" #include "minddata/dataset/util/status.h" #include "minddata/mindrecord/include/shard_reader.h" +#include "minddata/dataset/engine/gnn/graph_data_impl.h" namespace mindspore { namespace dataset { namespace gnn { @@ -49,8 +50,6 @@ using EdgeFeatureMap = std::unordered_map>; using DefaultEdgeFeatureMap = std::unordered_map>; -class GraphDataImpl; - // this class interfaces with the underlying storage format (mindrecord) // it returns raw nodes and edges via GetNodesAndEdges // it is then the responsibility of graph to construct itself based on the nodes and edges diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/cutmix_batch_op.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/cutmix_batch_op.cc index a03d5936b43..5125d6ee1d4 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/cutmix_batch_op.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/cutmix_batch_op.cc @@ -32,7 +32,7 @@ CutMixBatchOp::CutMixBatchOp(ImageBatchFormat image_batch_format, float alpha, f } void CutMixBatchOp::GetCropBox(int height, int width, float lam, int *x, int *y, int *crop_width, int *crop_height) { - float cut_ratio = 1 - lam; + const float cut_ratio = 1 - lam; int cut_w = static_cast(width * cut_ratio); int cut_h = static_cast(height * cut_ratio); std::uniform_int_distribution width_uniform_distribution(0, width); @@ -116,7 +116,6 @@ Status CutMixBatchOp::Compute(const TensorRow &input, TensorRow *output) { RETURN_IF_NOT_OK(Crop(rand_image, &cropped, x, y, crop_width, crop_height)); RETURN_IF_NOT_OK(MaskWithTensor(cropped, &images[i], x, y, crop_width, crop_height, ImageFormat::HWC)); label_lam = 1 - (crop_width * crop_height / static_cast(image_shape[1] * image_shape[2])); - } else { // NCHW Format GetCropBox(static_cast(image_shape[2]), static_cast(image_shape[3]), lam, &x, &y, &crop_width, diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_op.h b/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_op.h index 37e4f026559..5a50c7c90c8 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_op.h +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/random_color_op.h @@ -39,6 +39,8 @@ namespace dataset { class RandomColorOp : public TensorOp { public: RandomColorOp() = default; + + ~RandomColorOp() = default; /// \brief Constructor /// \param[in] t_lb lower bound for the random weights /// \param[in] t_ub upper bound for the random weights