diff --git a/mindspore/ccsrc/debug/debug_services.cc b/mindspore/ccsrc/debug/debug_services.cc index 9f8e314007c..4c74bd6395a 100644 --- a/mindspore/ccsrc/debug/debug_services.cc +++ b/mindspore/ccsrc/debug/debug_services.cc @@ -84,12 +84,11 @@ void DebugServices::CheckWatchpoints(std::vector *name, std::vector auto wp = std::get<1>(w_table_item); // check ONLY init conditions on intial suspended state. // skip other conditions on intial suspended state - // skip init condition on all the other states - if ((wp.condition.type == INIT) ^ init_dbg_suspend) continue; - + if (init_dbg_suspend && (wp.condition.type != INIT)) continue; + // skip init condition if not init suspend + if ((wp.condition.type == INIT) && !init_dbg_suspend) continue; // check change conditions only on step end. if (wp.change_condition() && !step_end) continue; - // if recheck, ignore the cache results and reanalyze everything. // if not a recheck, check only unanalyzed tensors if (!recheck && wp_id_cache[tensor_name].count(wp.id)) continue; diff --git a/mindspore/ccsrc/debug/debugger/tensor_summary.cc b/mindspore/ccsrc/debug/debugger/tensor_summary.cc index 5490696b113..afd46404020 100644 --- a/mindspore/ccsrc/debug/debugger/tensor_summary.cc +++ b/mindspore/ccsrc/debug/debugger/tensor_summary.cc @@ -36,7 +36,7 @@ void RangeCountCalculator::ProcessElement(double element) { total += 1; } -double RangeCountCalculator::GetPercentInRange() { +double RangeCountCalculator::GetPercentInRange() const { if (total == 0) { return 0.0; } @@ -46,7 +46,7 @@ double RangeCountCalculator::GetPercentInRange() { AllCloseCalculator::AllCloseCalculator() : atol(1.0e-8), rtol(1.0e-5), result(true) {} void AllCloseCalculator::ProcessElement(double current, double previous) { - result &= (std::abs(current - previous) <= (atol + rtol * std::abs(previous))); + result = result && (std::abs(current - previous) <= (atol + rtol * std::abs(previous))); } bool AllCloseCalculator::IsAllClose() { return result; } @@ -171,7 +171,7 @@ std::tuple> TensorSummary: inequality_type = "lt"; } parameter.Evaluate(StatLookup(parameter.name, wp), inequality_type); - hit |= parameter.hit; + hit = hit || parameter.hit; } } return std::make_tuple(hit, static_cast(error_code.to_ulong()), parameter_list); @@ -244,7 +244,7 @@ template void TensorSummary::InitCalculators(const std::vector &wps) { for (auto &wp : wps) { auto wp_id = wp.id; - mean_sd_cal_enabled |= wp.mean_sd_enabled(); + mean_sd_cal_enabled = mean_sd_cal_enabled || wp.mean_sd_enabled(); if (wp.allclose_enabled() && prev_tensor_ptr) { all_close[wp_id] = std::make_unique(); if (!wp.parameter_list[0].disabled) { diff --git a/mindspore/ccsrc/debug/debugger/tensor_summary.h b/mindspore/ccsrc/debug/debugger/tensor_summary.h index 84d98704a09..0f3aff96142 100644 --- a/mindspore/ccsrc/debug/debugger/tensor_summary.h +++ b/mindspore/ccsrc/debug/debugger/tensor_summary.h @@ -28,8 +28,9 @@ namespace mindspore { class RangeCountCalculator { public: RangeCountCalculator(); + ~RangeCountCalculator() = default; void ProcessElement(double element); - double GetPercentInRange(); + double GetPercentInRange() const; void set_range_start_inclusive(double value) { range_start_inclusive = value; } void set_range_end_inclusive(double value) { range_end_inclusive = value; } @@ -43,6 +44,7 @@ class RangeCountCalculator { class AllCloseCalculator { public: AllCloseCalculator(); + ~AllCloseCalculator() = default; void ProcessElement(double current, double previous); bool IsAllClose(); void set_atol(double value) { atol = value; } @@ -57,6 +59,7 @@ class AllCloseCalculator { class MeanCalculator { public: MeanCalculator(); + ~MeanCalculator() = default; void ProcessElement(double value); double GetMean(); @@ -68,6 +71,7 @@ class MeanCalculator { class VarianceAndMeanCalculator { public: VarianceAndMeanCalculator(); + ~VarianceAndMeanCalculator() = default; void ProcessElement(double value); double GetStandardDeviation(); double GetVariance(); @@ -91,6 +95,7 @@ template class TensorSummary : public ITensorSummary { public: TensorSummary() = default; + ~TensorSummary() override = default; TensorSummary(void *, void *, uint32_t); void SummarizeTensor(const std::vector &) override; // returns hit, error_code, parameter_list