Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Give clear exception when clients try to reuse ClassiferResults #1342

Merged
merged 2 commits into from
Jun 8, 2017

Conversation

scottpurdy
Copy link
Contributor

This is to address a community reported segfault by making it clear that you cannot reuse ClassificationResult instances across calls to SDRClassifier.compute. I looked into having compute simply return a new ClassifierResult but it looked like a major refactoring and I wasn't sure I was doing the right thing so punting on that for now.

@mrcslws please review
@ywcui1990 fyi

@scottpurdy scottpurdy requested a review from mrcslws June 7, 2017 22:21
Copy link
Contributor

@mrcslws mrcslws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a reasonable quick fix.

result_.insert(pair<Int, vector<Real64>*>(step, v));
}
NTA_CHECK(it == result_.end())
<< "The ClassifierResult cannot be reused!";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just use

NTA_CHECK(result_.count(step) == 0);

and get rid of the iterator.

@scottpurdy scottpurdy merged commit aa87d33 into numenta:master Jun 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants