Commit 7250ec45 by xiaotong

correct the name

parent 6a4741bc
...@@ -111,7 +111,7 @@ void _CrossEntropyFast(const XTensor * output, const XTensor * gold, ...@@ -111,7 +111,7 @@ void _CrossEntropyFast(const XTensor * output, const XTensor * gold,
{ {
#ifdef USE_CUDA #ifdef USE_CUDA
if(output->devID >= 0) { if(output->devID >= 0) {
_CudaCrossEntropyManual(output, gold, loss, weight, padding, leadingDim); _CudaCrossEntropyFast(output, gold, loss, weight, padding, leadingDim);
return; return;
} }
#endif #endif
...@@ -350,7 +350,7 @@ DTYPE _CrossEntropyFast(const XTensor * output, const XTensor * gold, ...@@ -350,7 +350,7 @@ DTYPE _CrossEntropyFast(const XTensor * output, const XTensor * gold,
{ {
#ifdef USE_CUDA #ifdef USE_CUDA
if(output->devID >= 0) { if(output->devID >= 0) {
return _CudaCrossEntropyManual(output, gold, reduceWay, weight, padding, leadingDim); return _CudaCrossEntropyFast(output, gold, reduceWay, weight, padding, leadingDim);
} }
#endif #endif
......
...@@ -232,7 +232,7 @@ DTYPE _CudaCrossEntropyFast(const XTensor * output, const XTensor * gold, ...@@ -232,7 +232,7 @@ DTYPE _CudaCrossEntropyFast(const XTensor * output, const XTensor * gold,
XTensor * lossInter = NewTensor(output->order - 1, dimSize, output->dataType, output->denseRatio, output->devID, output->mem); XTensor * lossInter = NewTensor(output->order - 1, dimSize, output->dataType, output->denseRatio, output->devID, output->mem);
_CudaCrossEntropyManual(output, gold, lossInter, weight, padding, leadingDim); _CudaCrossEntropyFast(output, gold, lossInter, weight, padding, leadingDim);
loss = _ReduceSumAll(lossInter); loss = _ReduceSumAll(lossInter);
......
...@@ -61,7 +61,7 @@ bool TestCrossEntropy1() ...@@ -61,7 +61,7 @@ bool TestCrossEntropy1()
gold->SetData(goldData, unitNum); gold->SetData(goldData, unitNum);
/* call CrossEntropy function */ /* call CrossEntropy function */
_CrossEntropyManual(output, gold, loss); _CrossEntropyFast(output, gold, loss);
error2 = _CrossEntropy(output, gold, REDUCE_SUM); error2 = _CrossEntropy(output, gold, REDUCE_SUM);
error1 = loss->Get1D(0); error1 = loss->Get1D(0);
...@@ -83,7 +83,7 @@ bool TestCrossEntropy1() ...@@ -83,7 +83,7 @@ bool TestCrossEntropy1()
goldGPU->SetData(goldData, unitNum); goldGPU->SetData(goldData, unitNum);
/* call CrossEntropy function */ /* call CrossEntropy function */
_CrossEntropyManual(outputGPU, goldGPU, lossGPU); _CrossEntropyFast(outputGPU, goldGPU, lossGPU);
error1 = lossGPU->Get1D(0); error1 = lossGPU->Get1D(0);
error2 = _CrossEntropy(outputGPU, goldGPU, REDUCE_SUM); error2 = _CrossEntropy(outputGPU, goldGPU, REDUCE_SUM);
...@@ -163,8 +163,8 @@ bool TestCrossEntropy2() ...@@ -163,8 +163,8 @@ bool TestCrossEntropy2()
/* call CrossEntropy function */ /* call CrossEntropy function */
error1 = _CrossEntropy(output, gold, REDUCE_SUM); error1 = _CrossEntropy(output, gold, REDUCE_SUM);
error2 = _CrossEntropy(output, gold, REDUCE_MEAN); error2 = _CrossEntropy(output, gold, REDUCE_MEAN);
error3 = _CrossEntropyManual(output, gold, REDUCE_SUM); error3 = _CrossEntropyFast(output, gold, REDUCE_SUM);
error4 = _CrossEntropyManual(output, gold, REDUCE_MEAN); error4 = _CrossEntropyFast(output, gold, REDUCE_MEAN);
/* check results */ /* check results */
cpuTest = (fabs(error1 - answer1) < 1e-4F && cpuTest = (fabs(error1 - answer1) < 1e-4F &&
...@@ -191,8 +191,8 @@ bool TestCrossEntropy2() ...@@ -191,8 +191,8 @@ bool TestCrossEntropy2()
/* call CrossEntropy function */ /* call CrossEntropy function */
error1 = _CrossEntropy(outputGPU, goldGPU, REDUCE_SUM); error1 = _CrossEntropy(outputGPU, goldGPU, REDUCE_SUM);
error2 = _CrossEntropy(outputGPU, goldGPU, REDUCE_MEAN); error2 = _CrossEntropy(outputGPU, goldGPU, REDUCE_MEAN);
error3 = _CrossEntropyManual(outputGPU, goldGPU, REDUCE_SUM); error3 = _CrossEntropyFast(outputGPU, goldGPU, REDUCE_SUM);
error4 = _CrossEntropyManual(outputGPU, goldGPU, REDUCE_MEAN); error4 = _CrossEntropyFast(outputGPU, goldGPU, REDUCE_MEAN);
/* check results */ /* check results */
gpuTest = (fabs(error1 - answer1) < 1e-4F && gpuTest = (fabs(error1 - answer1) < 1e-4F &&
...@@ -272,7 +272,7 @@ bool TestCrossEntropy3() ...@@ -272,7 +272,7 @@ bool TestCrossEntropy3()
gold->Set2D(1.0F, 3, 3); gold->Set2D(1.0F, 3, 3);
/* call CrossEntropy function */ /* call CrossEntropy function */
_CrossEntropyManual(output, gold, loss, weight); _CrossEntropyFast(output, gold, loss, weight);
/* check results */ /* check results */
cpuTest = loss->CheckData(answer, 4, 1e-4F); cpuTest = loss->CheckData(answer, 4, 1e-4F);
...@@ -297,7 +297,7 @@ bool TestCrossEntropy3() ...@@ -297,7 +297,7 @@ bool TestCrossEntropy3()
goldGPU->Set2D(1.0F, 3, 3); goldGPU->Set2D(1.0F, 3, 3);
/* call CrossEntropy function */ /* call CrossEntropy function */
_CrossEntropyManual(outputGPU, goldGPU, lossGPU, weightGPU); _CrossEntropyFast(outputGPU, goldGPU, lossGPU, weightGPU);
/* check results */ /* check results */
gpuTest = lossGPU->CheckData(answer, 4, 1e-4F); gpuTest = lossGPU->CheckData(answer, 4, 1e-4F);
...@@ -361,7 +361,7 @@ bool TestCrossEntropy4() ...@@ -361,7 +361,7 @@ bool TestCrossEntropy4()
_ScaleAndShiftMe(gold, 1, 2); _ScaleAndShiftMe(gold, 1, 2);
/* call CrossEntropy function */ /* call CrossEntropy function */
error = _CrossEntropyManual(output, gold); error = _CrossEntropyFast(output, gold);
/* check results */ /* check results */
cpuTest = (fabs(error - answer) < 1e-4); cpuTest = (fabs(error - answer) < 1e-4);
...@@ -381,7 +381,7 @@ bool TestCrossEntropy4() ...@@ -381,7 +381,7 @@ bool TestCrossEntropy4()
_ScaleAndShiftMe(goldGPU, 1, 2); _ScaleAndShiftMe(goldGPU, 1, 2);
/* call CrossEntropy function */ /* call CrossEntropy function */
error = _CrossEntropyManual(outputGPU, goldGPU); error = _CrossEntropyFast(outputGPU, goldGPU);
/* check results */ /* check results */
gpuTest = (fabs(error - answer) < 1e-4); gpuTest = (fabs(error - answer) < 1e-4);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论