提交 2368377a 编写于 作者: H hedaoyuan

Bug fix.

上级 6a14f52d
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
add_simple_unittest(test_ExecViaCpu) add_simple_unittest(test_ExecViaCpu)
add_simple_unittest(test_SIMDFunctions) add_simple_unittest(test_SIMDFunctions)
add_simple_unittest(test_TrainingAlgorithm) add_simple_unittest(test_TrainingAlgorithm)
add_simple_unittest(test_SparseMatrix)
add_simple_unittest(test_RowBuffer) add_simple_unittest(test_RowBuffer)
if(NOT MOBILE_INFERENCE)
add_simple_unittest(test_SparseMatrix)
endif()
# TODO(yuyang18): Refactor TestUtil.cpp. Remove this cross module reference. # TODO(yuyang18): Refactor TestUtil.cpp. Remove this cross module reference.
add_unittest(test_matrixCompare add_unittest(test_matrixCompare
......
...@@ -200,7 +200,9 @@ void Parameter::setMat(ParameterType pType, int matType) { ...@@ -200,7 +200,9 @@ void Parameter::setMat(ParameterType pType, int matType) {
false, false,
useGpu_); useGpu_);
} }
} else if (matType == MAT_NORMAL_SHARED) { }
#ifndef PADDLE_MOBILE_INFERENCE
else if (matType == MAT_NORMAL_SHARED) {
CHECK_EQ(height * width, bufs_[pType]->getSize()); CHECK_EQ(height * width, bufs_[pType]->getSize());
size_t blockNum = 0; size_t blockNum = 0;
CHECK(isGradShared(&blockNum)); CHECK(isGradShared(&blockNum));
...@@ -217,9 +219,7 @@ void Parameter::setMat(ParameterType pType, int matType) { ...@@ -217,9 +219,7 @@ void Parameter::setMat(ParameterType pType, int matType) {
bufs_[pType]->getMemoryHandle()), bufs_[pType]->getMemoryHandle()),
height, height,
width); width);
} } else if (matType == MAT_SPARSE_ROW_IDS) {
#ifndef PADDLE_MOBILE_INFERENCE
else if (matType == MAT_SPARSE_ROW_IDS) {
CHECK_EQ(height * width, bufs_[pType]->getSize()); CHECK_EQ(height * width, bufs_[pType]->getSize());
mats_[pType] = std::make_shared<SparseRowIdsCpuMatrix>( mats_[pType] = std::make_shared<SparseRowIdsCpuMatrix>(
std::dynamic_pointer_cast<CpuMemoryHandle>( std::dynamic_pointer_cast<CpuMemoryHandle>(
......
...@@ -33,6 +33,7 @@ MatrixPtr makeRandomSparseMatrix(size_t height, ...@@ -33,6 +33,7 @@ MatrixPtr makeRandomSparseMatrix(size_t height,
bool withValue, bool withValue,
bool useGpu, bool useGpu,
bool equalNnzPerSample) { bool equalNnzPerSample) {
#ifndef PADDLE_MOBILE_INFERENCE
std::vector<int64_t> ids(height); std::vector<int64_t> ids(height);
std::vector<int64_t> indices(height + 1); std::vector<int64_t> indices(height + 1);
indices[0] = 0; indices[0] = 0;
...@@ -84,6 +85,8 @@ MatrixPtr makeRandomSparseMatrix(size_t height, ...@@ -84,6 +85,8 @@ MatrixPtr makeRandomSparseMatrix(size_t height,
} }
return mat; return mat;
} }
#endif
return nullptr;
} }
void generateSequenceStartPositions(size_t batchSize, void generateSequenceStartPositions(size_t batchSize,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册