Commit cfa653cd by xiaotong

fix bug in dumping output sequence

parent cad766b4
...@@ -527,16 +527,16 @@ void T2TSearch::Dump(XTensor * output) ...@@ -527,16 +527,16 @@ void T2TSearch::Dump(XTensor * output)
T2TState * state = (T2TState *)heap.Pop().index; T2TState * state = (T2TState *)heap.Pop().index;
int count = 0; int count = 0;
bool isCompleted = false; bool isCompleted = true;
/* we track the state from the end to the beginning */ /* we track the state from the end to the beginning */
while(state != NULL){ while(state != NULL){
if(!state->isCompleted)
isCompleted = false;
if (isCompleted) if (isCompleted)
words[count++] = -1; words[count++] = -1;
else else
words[count++] = state->prediction; words[count++] = state->prediction;
if (state->isCompleted)
isCompleted = true;
state = state->last; state = state->last;
} }
......
...@@ -157,9 +157,9 @@ void T2TTester::Dump(FILE * file, XTensor * output) ...@@ -157,9 +157,9 @@ void T2TTester::Dump(FILE * file, XTensor * output)
for(int i = 0; i < output->unitNum; i += seqLength){ for(int i = 0; i < output->unitNum; i += seqLength){
for(int j = 0; j < seqLength; j++){ for(int j = 0; j < seqLength; j++){
int w = output->GetInt(i + j); int w = output->GetInt(i + j);
fprintf(file, "%d ", w);
if (w < 0) if (w < 0)
break; break;
fprintf(file, "%d ", w);
} }
fprintf(file, "\n"); fprintf(file, "\n");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论