From d623378ea0bb97b466c82980b31ee98d7c2d88e9 Mon Sep 17 00:00:00 2001 From: hedaoyuan Date: Tue, 10 Jan 2017 17:57:32 +0800 Subject: [PATCH] fix some warning about CpuSparseMatrix --- paddle/function/BufferArg.cpp | 11 +++++++++++ paddle/function/BufferArg.h | 12 ++---------- paddle/function/BufferArgTest.cpp | 1 + 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/paddle/function/BufferArg.cpp b/paddle/function/BufferArg.cpp index 65c6f3030..fde48a73b 100644 --- a/paddle/function/BufferArg.cpp +++ b/paddle/function/BufferArg.cpp @@ -15,6 +15,7 @@ limitations under the License. */ #include #include "BufferArg.h" +#include "paddle/math/SparseMatrix.h" namespace paddle { @@ -28,4 +29,14 @@ const SparseMatrixArg& BufferArg::sparse() const { return dynamic_cast(*this); } +SparseMatrixArg::SparseMatrixArg(const CpuSparseMatrix& sparse, ArgType argType) + : BufferArg(sparse, argType), + row_(reinterpret_cast(sparse.getRows()), VALUE_TYPE_INT32), + col_(reinterpret_cast(sparse.getCols()), VALUE_TYPE_INT32) {} + +SparseMatrixArg::SparseMatrixArg(const GpuSparseMatrix& sparse, ArgType argType) + : BufferArg(sparse, argType), + row_(reinterpret_cast(sparse.getRows()), VALUE_TYPE_INT32), + col_(reinterpret_cast(sparse.getCols()), VALUE_TYPE_INT32) {} + } // namespace paddle diff --git a/paddle/function/BufferArg.h b/paddle/function/BufferArg.h index 9649913fa..12352ba29 100644 --- a/paddle/function/BufferArg.h +++ b/paddle/function/BufferArg.h @@ -18,9 +18,7 @@ limitations under the License. */ #include "TensorShape.h" #include "TensorType.h" -#include "paddle/math/CpuSparseMatrix.h" #include "paddle/math/Matrix.h" -#include "paddle/math/SparseMatrix.h" namespace paddle { @@ -248,15 +246,9 @@ public: } } - SparseMatrixArg(const CpuSparseMatrix& sparse, ArgType argType = UNSPECIFIED) - : BufferArg(sparse, argType), - row_(reinterpret_cast(sparse.getRows()), VALUE_TYPE_INT32), - col_(reinterpret_cast(sparse.getCols()), VALUE_TYPE_INT32) {} + SparseMatrixArg(const CpuSparseMatrix& sparse, ArgType argType = UNSPECIFIED); - SparseMatrixArg(const GpuSparseMatrix& sparse, ArgType argType = UNSPECIFIED) - : BufferArg(sparse, argType), - row_(reinterpret_cast(sparse.getRows()), VALUE_TYPE_INT32), - col_(reinterpret_cast(sparse.getCols()), VALUE_TYPE_INT32) {} + SparseMatrixArg(const GpuSparseMatrix& sparse, ArgType argType = UNSPECIFIED); ~SparseMatrixArg() {} diff --git a/paddle/function/BufferArgTest.cpp b/paddle/function/BufferArgTest.cpp index a9ee3ab07..b34559743 100644 --- a/paddle/function/BufferArgTest.cpp +++ b/paddle/function/BufferArgTest.cpp @@ -16,6 +16,7 @@ limitations under the License. */ #include #include "Function.h" #include "paddle/math/MemoryHandle.h" +#include "paddle/math/SparseMatrix.h" namespace paddle { -- GitLab