Commit 5a9327f8 by xiaotong

debugging

parent 9a4446f1
......@@ -107,11 +107,14 @@ void T2TSearch::Search(T2TModel * model, XTensor * input, XTensor * padding, XTe
paddingBeam.ReshapeMerged(paddingBeam.order - 3);
/* max output-length = 2 * source-length */
maxLength = input->GetDim(-1) * 2;
CheckNTErrors(maxLength > 0, "no max length specified!");
int lengthLimit = input->GetDim(-1) * 2;
int l = 0;
CheckNTErrors(lengthLimit > 0, "no max length specified!");
T2TStateBundle * states = new T2TStateBundle[maxLength + 1];
T2TStateBundle * states = new T2TStateBundle[lengthLimit + 1];
T2TStateBundle * first = states;
T2TStateBundle * cur = NULL;
T2TStateBundle * next = NULL;
/* create the first state */
predictor.Create(model, &encodingBeam, input, beamSize, first);
......@@ -120,9 +123,9 @@ void T2TSearch::Search(T2TModel * model, XTensor * input, XTensor * padding, XTe
first->isStart = true;
/* generate the sequence from left to right */
for(int i = 0 ; i < maxLength; i++){
T2TStateBundle * cur = states + i;
T2TStateBundle * next = states + i + 1;
for(int l = 0 ; l < lengthLimit; l++){
cur = states + l;
next = states + l + 1;
/* read the current state */
predictor.Read(model, cur);
......@@ -148,7 +151,7 @@ void T2TSearch::Search(T2TModel * model, XTensor * input, XTensor * padding, XTe
}
/* fill the heap with imcomplete hypotheses if neccesary */
FillHeap(&states[maxLength]);
FillHeap(next);
Dump(output);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论