PR #3279 - revert to non RVO code
This commit is contained in:
parent
59c73f1c46
commit
e9466160c7
@ -232,7 +232,7 @@ DecoderState::decode(size_t num_results) const
|
|||||||
|
|
||||||
for (PathTrie* prefix : prefixes_copy) {
|
for (PathTrie* prefix : prefixes_copy) {
|
||||||
Output output;
|
Output output;
|
||||||
output.tokens = prefix->get_path_vec();
|
prefix->get_path_vec(output.tokens);
|
||||||
output.timesteps = prefix->timesteps;
|
output.timesteps = prefix->timesteps;
|
||||||
output.confidence = scores[prefix];
|
output.confidence = scores[prefix];
|
||||||
outputs.push_back(output);
|
outputs.push_back(output);
|
||||||
|
@ -99,15 +99,13 @@ PathTrie* PathTrie::get_path_trie(unsigned int new_char, float cur_log_prob_c, b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<unsigned int> PathTrie::get_path_vec() {
|
void PathTrie::get_path_vec(std::vector<unsigned int>& output) {
|
||||||
if (parent == nullptr) {
|
// Recursive call: recurse back until stop condition, then append data in
|
||||||
return std::vector<unsigned int>{};
|
// correct order as we walk back down the stack in the lines below.
|
||||||
|
if (parent != nullptr) {
|
||||||
|
parent->get_path_vec(output);
|
||||||
|
output.push_back(character);
|
||||||
}
|
}
|
||||||
std::vector<unsigned int> output_tokens=parent->get_path_vec();
|
|
||||||
if (character != ROOT_) {
|
|
||||||
output_tokens.push_back(character);
|
|
||||||
}
|
|
||||||
return output_tokens;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PathTrie* PathTrie::get_prev_grapheme(std::vector<unsigned int>& output,
|
PathTrie* PathTrie::get_prev_grapheme(std::vector<unsigned int>& output,
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
PathTrie* get_path_trie(unsigned int new_char, float log_prob_c, bool reset = true);
|
PathTrie* get_path_trie(unsigned int new_char, float log_prob_c, bool reset = true);
|
||||||
|
|
||||||
// get the prefix data in correct time order from root to current node
|
// get the prefix data in correct time order from root to current node
|
||||||
std::vector<unsigned int> get_path_vec();
|
void get_path_vec(std::vector<unsigned int>& output);
|
||||||
|
|
||||||
// get the prefix data in correct time order from beginning of last grapheme to current node
|
// get the prefix data in correct time order from beginning of last grapheme to current node
|
||||||
PathTrie* get_prev_grapheme(std::vector<unsigned int>& output,
|
PathTrie* get_prev_grapheme(std::vector<unsigned int>& output,
|
||||||
|
Loading…
Reference in New Issue
Block a user