Skip to content

Commit ae4400b

Browse files
committed
Bug fix for mac os
1 parent ee2da53 commit ae4400b

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

paddle/function/BufferArg.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class BufferArg {
126126
CHECK(buf_);
127127
CHECK(valueType_ == DataType<real>::value);
128128
// CHECK(deviceType_ == DType);
129-
CHECK_EQ(2, shape_.ndims());
129+
CHECK_EQ((size_t)2, shape_.ndims());
130130
return typename Tensor<real, DType>::Matrix(
131131
reinterpret_cast<real*>(buf_), shape_[0], shape_[1]);
132132
}
@@ -136,7 +136,7 @@ class BufferArg {
136136
CHECK(buf_);
137137
CHECK(valueType_ == DataType<VType>::value);
138138
// CHECK(deviceType_ == DType);
139-
CHECK_EQ(1, shape_.ndims());
139+
CHECK_EQ((size_t)1, shape_.ndims());
140140
return typename Tensor<VType, DType>::Vector(
141141
shape_[0], reinterpret_cast<VType*>(buf_));
142142
}
@@ -176,7 +176,7 @@ class SequenceIdArg : public BufferArg {
176176
const TensorShape& shape,
177177
ArgType argType = UNSPECIFIED)
178178
: BufferArg(buf, VALUE_TYPE_INT32, shape, argType) {
179-
CHECK_EQ(shape_.ndims(), 1);
179+
CHECK_EQ(shape_.ndims(), (size_t)1);
180180
numSeqs_ = shape_[0] - 1;
181181
}
182182

@@ -238,9 +238,9 @@ class SparseMatrixArg : public BufferArg {
238238
format_(format),
239239
type_(type) {
240240
CHECK((valueType == VALUE_TYPE_FLOAT) || (valueType == VALUE_TYPE_DOUBLE));
241-
CHECK_EQ(shape_.ndims(), 2);
242-
CHECK_EQ(row_.shape().ndims(), 1);
243-
CHECK_EQ(col_.shape().ndims(), 1);
241+
CHECK_EQ(shape_.ndims(), (size_t)2);
242+
CHECK_EQ(row_.shape().ndims(), (size_t)1);
243+
CHECK_EQ(col_.shape().ndims(), (size_t)1);
244244
if (format == SPARSE_CSR_FORMAT) {
245245
CHECK_EQ(nnz, col.shape()[0]);
246246
} else if (format == SPARSE_CSC_FORMAT) {

paddle/function/ContextProjectionOp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ class ContextProjectionForwardFunc : public FunctionBase {
8585
}
8686

8787
void calc(const BufferArgs& inputs, const BufferArgs& outputs) override {
88-
CHECK_EQ(3, inputs.size());
89-
CHECK_EQ(1, outputs.size());
88+
CHECK_EQ((size_t)3, inputs.size());
89+
CHECK_EQ((size_t)1, outputs.size());
9090

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

195195
void calc(const BufferArgs& inputs, const BufferArgs& outputs) override {
196-
CHECK_EQ(3, inputs.size());
197-
CHECK_EQ(1, outputs.size());
196+
CHECK_EQ((size_t)3, inputs.size());
197+
CHECK_EQ((size_t)1, outputs.size());
198198

199199
CHECK(outputs[0].data() && inputs[2].data());
200200
CHECK_EQ(outputs[0].shape().ndims(), (size_t)2);

paddle/function/CrossMapNormalOp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class CrossMapNormalFunc : public FunctionBase {
131131
CHECK_EQ((size_t)1, inputs.size());
132132
CHECK_EQ((size_t)2, outputs.size());
133133

134-
CHECK_EQ(inputs[0].shape().ndims(), 4);
134+
CHECK_EQ(inputs[0].shape().ndims(), (size_t)4);
135135
CHECK(inputs[0].shape() == outputs[0].shape());
136136
CHECK(inputs[0].shape() == outputs[1].shape());
137137

@@ -182,7 +182,7 @@ class CrossMapNormalGradFunc : public FunctionBase {
182182
CHECK_EQ((size_t)4, inputs.size());
183183
CHECK_EQ((size_t)1, outputs.size());
184184

185-
CHECK_EQ(inputs[0].shape().ndims(), 4);
185+
CHECK_EQ(inputs[0].shape().ndims(), (size_t)4);
186186
CHECK(inputs[0].shape() == inputs[1].shape());
187187
CHECK(inputs[0].shape() == inputs[2].shape());
188188
CHECK(inputs[0].shape() == inputs[3].shape());

paddle/function/TensorShape.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ class TensorShape {
4242

4343
// get the size of specified dimension
4444
size_t operator[](size_t dim) const {
45-
CHECK_GE(dim, 0);
45+
CHECK_GE(dim, (size_t)0);
4646
CHECK_LT(dim, ndims_);
4747
return dims_[dim];
4848
}
4949

5050
// set the size of specified dimension
5151
void setDim(size_t dim, size_t size) {
52-
CHECK_GE(dim, 0);
52+
CHECK_GE(dim, (size_t)0);
5353
CHECK_LT(dim, ndims_);
5454
dims_[dim] = size;
5555
numElements();

0 commit comments

Comments
 (0)