Skip to content

Commit

Permalink
Bug fix for mac os
Browse files Browse the repository at this point in the history
  • Loading branch information
hedaoyuan committed Jan 10, 2017
1 parent ee2da53 commit ae4400b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions paddle/function/BufferArg.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class BufferArg {
CHECK(buf_);
CHECK(valueType_ == DataType<real>::value);
// CHECK(deviceType_ == DType);
CHECK_EQ(2, shape_.ndims());
CHECK_EQ((size_t)2, shape_.ndims());
return typename Tensor<real, DType>::Matrix(
reinterpret_cast<real*>(buf_), shape_[0], shape_[1]);
}
Expand All @@ -136,7 +136,7 @@ class BufferArg {
CHECK(buf_);
CHECK(valueType_ == DataType<VType>::value);
// CHECK(deviceType_ == DType);
CHECK_EQ(1, shape_.ndims());
CHECK_EQ((size_t)1, shape_.ndims());
return typename Tensor<VType, DType>::Vector(
shape_[0], reinterpret_cast<VType*>(buf_));
}
Expand Down Expand Up @@ -176,7 +176,7 @@ class SequenceIdArg : public BufferArg {
const TensorShape& shape,
ArgType argType = UNSPECIFIED)
: BufferArg(buf, VALUE_TYPE_INT32, shape, argType) {
CHECK_EQ(shape_.ndims(), 1);
CHECK_EQ(shape_.ndims(), (size_t)1);
numSeqs_ = shape_[0] - 1;
}

Expand Down Expand Up @@ -238,9 +238,9 @@ class SparseMatrixArg : public BufferArg {
format_(format),
type_(type) {
CHECK((valueType == VALUE_TYPE_FLOAT) || (valueType == VALUE_TYPE_DOUBLE));
CHECK_EQ(shape_.ndims(), 2);
CHECK_EQ(row_.shape().ndims(), 1);
CHECK_EQ(col_.shape().ndims(), 1);
CHECK_EQ(shape_.ndims(), (size_t)2);
CHECK_EQ(row_.shape().ndims(), (size_t)1);
CHECK_EQ(col_.shape().ndims(), (size_t)1);
if (format == SPARSE_CSR_FORMAT) {
CHECK_EQ(nnz, col.shape()[0]);
} else if (format == SPARSE_CSC_FORMAT) {
Expand Down
8 changes: 4 additions & 4 deletions paddle/function/ContextProjectionOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class ContextProjectionForwardFunc : public FunctionBase {
}

void calc(const BufferArgs& inputs, const BufferArgs& outputs) override {
CHECK_EQ(3, inputs.size());
CHECK_EQ(1, outputs.size());
CHECK_EQ((size_t)3, inputs.size());
CHECK_EQ((size_t)1, outputs.size());

CHECK(outputs[0].data() && inputs[0].data() && inputs[2].data());
CHECK_EQ(outputs[0].shape().ndims(), (size_t)2);
Expand Down Expand Up @@ -193,8 +193,8 @@ class ContextProjectionBackwardFunc : public FunctionBase {
}

void calc(const BufferArgs& inputs, const BufferArgs& outputs) override {
CHECK_EQ(3, inputs.size());
CHECK_EQ(1, outputs.size());
CHECK_EQ((size_t)3, inputs.size());
CHECK_EQ((size_t)1, outputs.size());

CHECK(outputs[0].data() && inputs[2].data());
CHECK_EQ(outputs[0].shape().ndims(), (size_t)2);
Expand Down
4 changes: 2 additions & 2 deletions paddle/function/CrossMapNormalOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class CrossMapNormalFunc : public FunctionBase {
CHECK_EQ((size_t)1, inputs.size());
CHECK_EQ((size_t)2, outputs.size());

CHECK_EQ(inputs[0].shape().ndims(), 4);
CHECK_EQ(inputs[0].shape().ndims(), (size_t)4);
CHECK(inputs[0].shape() == outputs[0].shape());
CHECK(inputs[0].shape() == outputs[1].shape());

Expand Down Expand Up @@ -182,7 +182,7 @@ class CrossMapNormalGradFunc : public FunctionBase {
CHECK_EQ((size_t)4, inputs.size());
CHECK_EQ((size_t)1, outputs.size());

CHECK_EQ(inputs[0].shape().ndims(), 4);
CHECK_EQ(inputs[0].shape().ndims(), (size_t)4);
CHECK(inputs[0].shape() == inputs[1].shape());
CHECK(inputs[0].shape() == inputs[2].shape());
CHECK(inputs[0].shape() == inputs[3].shape());
Expand Down
4 changes: 2 additions & 2 deletions paddle/function/TensorShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ class TensorShape {

// get the size of specified dimension
size_t operator[](size_t dim) const {
CHECK_GE(dim, 0);
CHECK_GE(dim, (size_t)0);
CHECK_LT(dim, ndims_);
return dims_[dim];
}

// set the size of specified dimension
void setDim(size_t dim, size_t size) {
CHECK_GE(dim, 0);
CHECK_GE(dim, (size_t)0);
CHECK_LT(dim, ndims_);
dims_[dim] = size;
numElements();
Expand Down

0 comments on commit ae4400b

Please sign in to comment.