Commit ff8b2cf9 by xiaotong

dump competed hypotheses

parent 20e3ac15
...@@ -530,7 +530,7 @@ void T2TSearch::Dump(XTensor * output) ...@@ -530,7 +530,7 @@ void T2TSearch::Dump(XTensor * output)
/* 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){
words[count++] = state->prediction; words[count++] = state->isCompleted ? -1 : state->prediction;
state = state->last; state = state->last;
} }
......
...@@ -144,5 +144,21 @@ void T2TTester::Test(const char * fn, const char * ofn, T2TModel * model) ...@@ -144,5 +144,21 @@ void T2TTester::Test(const char * fn, const char * ofn, T2TModel * model)
XPRINT3(0, stderr, "[INFO] test finished (took %.1fs, word=%d, and ppl=%.3f)\n", XPRINT3(0, stderr, "[INFO] test finished (took %.1fs, word=%d, and ppl=%.3f)\n",
elapsed,wordCountTotal, exp(loss/wordCount)); elapsed,wordCountTotal, exp(loss/wordCount));
} }
/*
dump the result into the file
>> file - data file
>> output - output tensor
*/
void T2TTester::Dump(FILE * file, const XTensor * output)
{
int seqLength = output->GetDim(-1);
for(int i = 0; i < output->unitNum; i += seqLength){
for(int j = 0; j < seqLength; j++){
}
}
}
} }
...@@ -57,8 +57,11 @@ public: ...@@ -57,8 +57,11 @@ public:
/* test the model */ /* test the model */
void Test(const char * fn, const char * ofn, T2TModel * model); void Test(const char * fn, const char * ofn, T2TModel * model);
/* dump the result into the file */
void Dump(FILE * file, const XTensor * output);
}; };
} }
#endif #endif
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论