Commit 9f12ebd2 by liyinqiao

Bug fixed.

Fix the bugs in Sum and Sub when MKL or OpenBlas is used.
parent b801df51
......@@ -92,7 +92,28 @@ void _Sum(const XTensor * a, const XTensor * b, XTensor * c, DTYPE beta)
#if defined(USE_BLAS)
if (c == a) {
AXPY(a->unitNum,beta,bp,1,cp,1);
return;
}
else {
int num = a->unitNum;
if (num % 4 == 0) {
for (int i = 0; i < num; i += 4) {
cp[i] = ap[i] + bp[i] * beta;
cp[i + 1] = ap[i + 1] + bp[i + 1] * beta;
cp[i + 2] = ap[i + 2] + bp[i + 2] * beta;
cp[i + 3] = ap[i + 3] + bp[i + 3] * beta;
}
}
else if (num % 2 == 0) {
for (int i = 0; i < num; i += 2) {
cp[i] = ap[i] + bp[i] * beta;
cp[i + 1] = ap[i + 1] + bp[i + 1] * beta;
}
}
else {
for (int i = 0; i < num; i++) {
cp[i] = ap[i] + bp[i] * beta;
}
}
}
#else
/* unrolling */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论