diff --git a/paddle/math/tests/TestUtils.h b/paddle/math/tests/TestUtils.h index ffcb71044e447488cbd6c53cb042445d3d8c6c06..2edb07de0144ba194cd18e644fbc93efcbe4837a 100644 --- a/paddle/math/tests/TestUtils.h +++ b/paddle/math/tests/TestUtils.h @@ -93,6 +93,11 @@ float construct(int height, int width) { return 0.5; } +template <> +double construct(int height, int width) { + return 0.5; +} + template <> size_t construct(int height, int width) { size_t offset = std::rand() % (height < width ? height : width); diff --git a/paddle/math/tests/test_matrixCompare.cpp b/paddle/math/tests/test_matrixCompare.cpp index 0e9ca161410566220a5d446784a5444077d37c1a..0883066947ae67cd55c2c505eef72168f3139b8d 100644 --- a/paddle/math/tests/test_matrixCompare.cpp +++ b/paddle/math/tests/test_matrixCompare.cpp @@ -290,8 +290,8 @@ void testMatrixDeepSwap(int height, int width) { // swap matrix cpuA and cpuB cpuA->deepSwap(*cpuB); - MatrixCheckEqual(*cpuA, *cpuCopyB); - MatrixCheckEqual(*cpuB, *cpuCopyA); + TensorCheckEqual(*cpuA, *cpuCopyB); + TensorCheckEqual(*cpuB, *cpuCopyA); } void testMatrixTranspose(int height, int width) {