From b98d8eeeee249c9c0a96242a5d002213de802eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jules=20Fran=C3=A7oise?= Date: Wed, 27 Apr 2016 09:45:59 -0700 Subject: [PATCH] Fix Json input with new transition data structure --- src/models/hierarchical_hmm.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/models/hierarchical_hmm.cpp b/src/models/hierarchical_hmm.cpp index 6238488..8eefc6c 100644 --- a/src/models/hierarchical_hmm.cpp +++ b/src/models/hierarchical_hmm.cpp @@ -931,6 +931,7 @@ void xmm::HierarchicalHMM::from_json(JSONNode root) { "Wrong type for node 'prior': was expecting " "'JSON_ARRAY'", root_it->name()); + prior.resize(numModels); json2vector(*root_it, prior, numModels); // Get High-level Exit Probabilities @@ -942,6 +943,7 @@ void xmm::HierarchicalHMM::from_json(JSONNode root) { "Wrong type for node 'exit': was expecting " "'JSON_ARRAY'", root_it->name()); + exitTransition.resize(numModels); json2vector(*root_it, exitTransition, numModels); // Get High-level Transition Matrix @@ -956,9 +958,11 @@ void xmm::HierarchicalHMM::from_json(JSONNode root) { std::vector trans(numModels * numModels); json2vector(*root_it, trans, numModels * numModels); transition.resize(numModels); - for (int i = 0; i < numModels; i++) + for (int i = 0; i < numModels; i++) { + transition[i].resize(numModels); for (int j = 0; j < numModels; j++) transition[i][j] = trans[i * numModels + j]; + } } catch (JSONException& e) { throw JSONException(e, root.name());