| @@ -84,12 +84,11 @@ void DebugServices::CheckWatchpoints(std::vector<std::string> *name, std::vector | |||||
| auto wp = std::get<1>(w_table_item); | auto wp = std::get<1>(w_table_item); | ||||
| // check ONLY init conditions on intial suspended state. | // check ONLY init conditions on intial suspended state. | ||||
| // skip other 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. | // check change conditions only on step end. | ||||
| if (wp.change_condition() && !step_end) continue; | if (wp.change_condition() && !step_end) continue; | ||||
| // if recheck, ignore the cache results and reanalyze everything. | // if recheck, ignore the cache results and reanalyze everything. | ||||
| // if not a recheck, check only unanalyzed tensors | // if not a recheck, check only unanalyzed tensors | ||||
| if (!recheck && wp_id_cache[tensor_name].count(wp.id)) continue; | if (!recheck && wp_id_cache[tensor_name].count(wp.id)) continue; | ||||
| @@ -36,7 +36,7 @@ void RangeCountCalculator::ProcessElement(double element) { | |||||
| total += 1; | total += 1; | ||||
| } | } | ||||
| double RangeCountCalculator::GetPercentInRange() { | |||||
| double RangeCountCalculator::GetPercentInRange() const { | |||||
| if (total == 0) { | if (total == 0) { | ||||
| return 0.0; | return 0.0; | ||||
| } | } | ||||
| @@ -46,7 +46,7 @@ double RangeCountCalculator::GetPercentInRange() { | |||||
| AllCloseCalculator::AllCloseCalculator() : atol(1.0e-8), rtol(1.0e-5), result(true) {} | AllCloseCalculator::AllCloseCalculator() : atol(1.0e-8), rtol(1.0e-5), result(true) {} | ||||
| void AllCloseCalculator::ProcessElement(double current, double previous) { | 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; } | bool AllCloseCalculator::IsAllClose() { return result; } | ||||
| @@ -171,7 +171,7 @@ std::tuple<bool, int, std::vector<DebugServices::parameter_t>> TensorSummary<T>: | |||||
| inequality_type = "lt"; | inequality_type = "lt"; | ||||
| } | } | ||||
| parameter.Evaluate(StatLookup(parameter.name, wp), inequality_type); | 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); | 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) { | void TensorSummary<T>::InitCalculators(const std::vector<DebugServices::watchpoint_t> &wps) { | ||||
| for (auto &wp : wps) { | for (auto &wp : wps) { | ||||
| auto wp_id = wp.id; | 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) { | if (wp.allclose_enabled() && prev_tensor_ptr) { | ||||
| all_close[wp_id] = std::make_unique<AllCloseCalculator>(); | all_close[wp_id] = std::make_unique<AllCloseCalculator>(); | ||||
| if (!wp.parameter_list[0].disabled) { | if (!wp.parameter_list[0].disabled) { | ||||
| @@ -28,8 +28,9 @@ namespace mindspore { | |||||
| class RangeCountCalculator { | class RangeCountCalculator { | ||||
| public: | public: | ||||
| RangeCountCalculator(); | RangeCountCalculator(); | ||||
| ~RangeCountCalculator() = default; | |||||
| void ProcessElement(double element); | void ProcessElement(double element); | ||||
| double GetPercentInRange(); | |||||
| double GetPercentInRange() const; | |||||
| void set_range_start_inclusive(double value) { range_start_inclusive = value; } | void set_range_start_inclusive(double value) { range_start_inclusive = value; } | ||||
| void set_range_end_inclusive(double value) { range_end_inclusive = value; } | void set_range_end_inclusive(double value) { range_end_inclusive = value; } | ||||
| @@ -43,6 +44,7 @@ class RangeCountCalculator { | |||||
| class AllCloseCalculator { | class AllCloseCalculator { | ||||
| public: | public: | ||||
| AllCloseCalculator(); | AllCloseCalculator(); | ||||
| ~AllCloseCalculator() = default; | |||||
| void ProcessElement(double current, double previous); | void ProcessElement(double current, double previous); | ||||
| bool IsAllClose(); | bool IsAllClose(); | ||||
| void set_atol(double value) { atol = value; } | void set_atol(double value) { atol = value; } | ||||
| @@ -57,6 +59,7 @@ class AllCloseCalculator { | |||||
| class MeanCalculator { | class MeanCalculator { | ||||
| public: | public: | ||||
| MeanCalculator(); | MeanCalculator(); | ||||
| ~MeanCalculator() = default; | |||||
| void ProcessElement(double value); | void ProcessElement(double value); | ||||
| double GetMean(); | double GetMean(); | ||||
| @@ -68,6 +71,7 @@ class MeanCalculator { | |||||
| class VarianceAndMeanCalculator { | class VarianceAndMeanCalculator { | ||||
| public: | public: | ||||
| VarianceAndMeanCalculator(); | VarianceAndMeanCalculator(); | ||||
| ~VarianceAndMeanCalculator() = default; | |||||
| void ProcessElement(double value); | void ProcessElement(double value); | ||||
| double GetStandardDeviation(); | double GetStandardDeviation(); | ||||
| double GetVariance(); | double GetVariance(); | ||||
| @@ -91,6 +95,7 @@ template <typename T> | |||||
| class TensorSummary : public ITensorSummary { | class TensorSummary : public ITensorSummary { | ||||
| public: | public: | ||||
| TensorSummary() = default; | TensorSummary() = default; | ||||
| ~TensorSummary() override = default; | |||||
| TensorSummary(void *, void *, uint32_t); | TensorSummary(void *, void *, uint32_t); | ||||
| void SummarizeTensor(const std::vector<DebugServices::watchpoint_t> &) override; | void SummarizeTensor(const std::vector<DebugServices::watchpoint_t> &) override; | ||||
| // returns hit, error_code, parameter_list | // returns hit, error_code, parameter_list | ||||