trunk: changes to cu-block-matrix-test to help diagnose failures on some platforms.

git-svn-id: https://svn.code.sf.net/p/kaldi/code/trunk@3213 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
This commit is contained in:
Dan Povey 2013-11-23 18:23:39 +00:00
Родитель 6562e3fbe9
Коммит f8e0e3bd62
1 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -73,6 +73,15 @@ static void AssertEqual(const CuBlockMatrix<Real> &A,
}
template<typename Real>
static bool ApproxEqual(const CuBlockMatrix<Real> &A,
const CuBlockMatrix<Real> &B,
float tol = 0.001) {
CuMatrix<Real> Acopy(A), Bcopy(B);
return Acopy.ApproxEqual(Bcopy, tol);
}
@ -192,7 +201,13 @@ static void UnitTestCuBlockMatrixAddMatMat() {
// same as B.
Bcopy.CopyFromMat(Bmat); // copy block-structured part from Bmat to Bcopy.
AssertEqual(B, Bcopy);
if (!ApproxEqual(B, Bcopy)) {
KALDI_WARN << "CuBlockMatrixTest failure, please report to maintainers: Bcopy = "
<< Bcopy << ", B = " << B << ", C = " << C << ", D = " << D
<< ", Bmat = " << B << " transD = " << transD << ", transC = "
<< transC;
KALDI_ERR << "Please give this log to the maintainers.";
}
KALDI_ASSERT(Bmat.Sum() != 0 || B_num_rows == 0);
}
}