From d462568bb381ebdd90404b72853b4df93e7f51db Mon Sep 17 00:00:00 2001 From: suzusuzu Date: Thu, 30 May 2019 20:47:54 +0900 Subject: [PATCH] fix iter bug --- src/nupic/algorithms/SDRClassifier.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nupic/algorithms/SDRClassifier.cpp b/src/nupic/algorithms/SDRClassifier.cpp index 45b5682444..1e18b40189 100644 --- a/src/nupic/algorithms/SDRClassifier.cpp +++ b/src/nupic/algorithms/SDRClassifier.cpp @@ -232,9 +232,9 @@ vector SDRClassifier::calculateError_(const vector &bucketIdxList, void SDRClassifier::softmax_(vector::iterator begin, vector::iterator end) { - vector::iterator maxItr = max_element(begin, end); + Real64 maxValue = *max_element(begin, end); for (auto itr = begin; itr != end; ++itr) { - *itr -= *maxItr; + *itr -= maxValue; } range_exp(1.0, begin, end); Real64 sum = accumulate(begin, end, 0.0);