Make return states the same size as the parent array.

Both arrays have always the same size and after reducing common parents in a prediction context optimization we also have to update the states array.
This commit is contained in:
Mike Lischke 2016-12-21 10:36:46 +01:00
parent e1fb0b68c7
commit 218ae73608
1 changed files with 3 additions and 1 deletions

View File

@ -350,8 +350,10 @@ Ref<PredictionContext> PredictionContext::mergeArrays(const Ref<ArrayPredictionC
} }
// ml: this part differs from Java code. We have to recreate the context as the parents array is copied on creation. // ml: this part differs from Java code. We have to recreate the context as the parents array is copied on creation.
if (combineCommonParents(mergedParents)) if (combineCommonParents(mergedParents)) {
mergedReturnStates.resize(mergedParents.size());
M = std::make_shared<ArrayPredictionContext>(mergedParents, mergedReturnStates); M = std::make_shared<ArrayPredictionContext>(mergedParents, mergedReturnStates);
}
if (mergeCache != nullptr) { if (mergeCache != nullptr) {
mergeCache->put(a, b, M); mergeCache->put(a, b, M);