| @@ -84,12 +84,11 @@ void DebugServices::CheckWatchpoints(std::vector<std::string> *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; | |||
| @@ -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<bool, int, std::vector<DebugServices::parameter_t>> TensorSummary<T>: | |||
| 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<int32_t>(error_code.to_ulong()), parameter_list); | |||
| @@ -244,7 +244,7 @@ template <typename T> | |||
| void TensorSummary<T>::InitCalculators(const std::vector<DebugServices::watchpoint_t> &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<AllCloseCalculator>(); | |||
| if (!wp.parameter_list[0].disabled) { | |||
| @@ -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 <typename T> | |||
| class TensorSummary : public ITensorSummary { | |||
| public: | |||
| TensorSummary() = default; | |||
| ~TensorSummary() override = default; | |||
| TensorSummary(void *, void *, uint32_t); | |||
| void SummarizeTensor(const std::vector<DebugServices::watchpoint_t> &) override; | |||
| // returns hit, error_code, parameter_list | |||