Skip to content

Commit

Permalink
Merge pull request #1112 from hedaoyuan/warning
Browse files Browse the repository at this point in the history
fix some warning about CpuSparseMatrix
  • Loading branch information
hedaoyuan authored Jan 11, 2017
2 parents 9e6c8cd + d623378 commit 441d00e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
11 changes: 11 additions & 0 deletions paddle/function/BufferArg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License. */
#include <glog/logging.h>

#include "BufferArg.h"
#include "paddle/math/SparseMatrix.h"

namespace paddle {

Expand All @@ -28,4 +29,14 @@ const SparseMatrixArg& BufferArg::sparse() const {
return dynamic_cast<const SparseMatrixArg&>(*this);
}

SparseMatrixArg::SparseMatrixArg(const CpuSparseMatrix& sparse, ArgType argType)
: BufferArg(sparse, argType),
row_(reinterpret_cast<void*>(sparse.getRows()), VALUE_TYPE_INT32),
col_(reinterpret_cast<void*>(sparse.getCols()), VALUE_TYPE_INT32) {}

SparseMatrixArg::SparseMatrixArg(const GpuSparseMatrix& sparse, ArgType argType)
: BufferArg(sparse, argType),
row_(reinterpret_cast<void*>(sparse.getRows()), VALUE_TYPE_INT32),
col_(reinterpret_cast<void*>(sparse.getCols()), VALUE_TYPE_INT32) {}

} // namespace paddle
12 changes: 2 additions & 10 deletions paddle/function/BufferArg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -248,15 +246,9 @@ class SparseMatrixArg : public BufferArg {
}
}

SparseMatrixArg(const CpuSparseMatrix& sparse, ArgType argType = UNSPECIFIED)
: BufferArg(sparse, argType),
row_(reinterpret_cast<void*>(sparse.getRows()), VALUE_TYPE_INT32),
col_(reinterpret_cast<void*>(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<void*>(sparse.getRows()), VALUE_TYPE_INT32),
col_(reinterpret_cast<void*>(sparse.getCols()), VALUE_TYPE_INT32) {}
SparseMatrixArg(const GpuSparseMatrix& sparse, ArgType argType = UNSPECIFIED);

~SparseMatrixArg() {}

Expand Down
1 change: 1 addition & 0 deletions paddle/function/BufferArgTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License. */
#include <gtest/gtest.h>
#include "Function.h"
#include "paddle/math/MemoryHandle.h"
#include "paddle/math/SparseMatrix.h"

namespace paddle {

Expand Down

0 comments on commit 441d00e

Please sign in to comment.