Skip to content

Commit 239af78

Browse files
authored
small compiler warning fixes (deeplearning4j#10172)
1 parent 58b9184 commit 239af78

File tree

18 files changed

+97
-71
lines changed

18 files changed

+97
-71
lines changed

libnd4j/include/loops/pairwise_bool.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,13 @@ class PairWiseBoolTransform {
6161
const sd::LongType *yShapeBuffer, void *result, const sd::LongType *resultShapeBuffer,
6262
void *extraParams, sd::LongType start,sd::LongType stop);
6363

64-
static void exec(int opNum, const void *dx, sd::LongType xStride, const void *y, sd::LongType yStride, void *result,
65-
sd::LongType resultStride, void *extraParams, sd::LongType n,sd::LongType start,
66-
sd::LongType stop);
64+
6765

6866
template <typename OpType>
6967
static void exec(const void *vx, const sd::LongType *xShapeBuffer, const void *vy, const sd::LongType *yShapeBuffer,
7068
void *vresult, const sd::LongType *resultShapeBuffer, void *vextraParams, sd::LongType start,
7169
sd::LongType stop);
7270

73-
template <typename OpType>
74-
static void exec(const void *vx, sd::LongType xStride, const void *vy, sd::LongType yStride, void *vresult,
75-
sd::LongType resultStride, void *vextraParams, sd::LongType n, sd::LongType start,
76-
sd::LongType stop);
7771
#endif
7872
};
7973
} // namespace pairwise_transforms

libnd4j/include/loops/pairwise_int.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ class PairWiseIntTransform {
6262
const sd::LongType *yShapeBuffer, void *result, const sd::LongType *resultShapeBuffer,
6363
void *extraParams, uint64_t start, uint64_t stop);
6464

65-
static void exec(int opNum, const void *dx, sd::LongType xStride, const void *y, sd::LongType yStride, void *result,
66-
sd::LongType resultStride, void *extraParams, sd::LongType n, uint64_t start, uint64_t stop);
67-
6865
template <typename OpType>
6966
static void exec(const void *vx, const sd::LongType *xShapeBuffer, const void *vy, const sd::LongType *yShapeBuffer,
7067
void *vresult, const sd::LongType *resultShapeBuffer, void *vextraParams, uint64_t start,

libnd4j/include/ops/declarable/generic/compat/compat_string_split.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ CUSTOM_OP_IMPL(compat_string_split, 2, 2, false, 0, 0) {
4444

4545
// getting buffer lengths
4646
auto outputLength = StringUtils::byteLength(*input);
47-
LongType ss = 0L;
4847
LongType ic = 0L;
4948
int len = input->isScalar() ? 1 : input->lengthOf();
5049

@@ -71,7 +70,6 @@ CUSTOM_OP_IMPL(compat_string_split, 2, 2, false, 0, 0) {
7170
indices->p(ic++, f);
7271
}
7372

74-
ss += cnt;
7573
}
7674

7775
// process strings now

libnd4j/include/ops/declarable/generic/shape/reshape_no_copy.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ DECLARE_SHAPE_FN(reshape_no_copy) {
3939
auto shapeArg = INPUT_VARIABLE(1);
4040
auto shapeBuffLong = shapeArg->getBufferAsVector<sd::LongType>();
4141
// last is the ordering
42-
for (int i = 0; i < shapeBuffLong.size() - 1; i++) {
42+
for (size_t i = 0; i < shapeBuffLong.size() - 1; i++) {
4343
newShape.push_back(shapeBuffLong[i]);
4444
}
4545

@@ -57,7 +57,7 @@ DECLARE_SHAPE_FN(reshape_no_copy) {
5757
}
5858
} else {
5959
std::vector<sd::LongType> *iArgs = block.getIArguments();
60-
for (LongType i = 0; i < block.numI() - 1; i++) {
60+
for (size_t i = 0; i < block.numI() - 1; i++) {
6161
newShape.push_back(iArgs->at(i));
6262
}
6363
order = iArgs->at(iArgs->size() - 1) == RESHAPE_NO_COPY_F_ORDER_MARKER ? 'f' : 'c';
@@ -70,7 +70,7 @@ DECLARE_SHAPE_FN(reshape_no_copy) {
7070
shape::setOrder(newShapeInfo, order);
7171
auto newShapeView = shape::shapeOf(newShapeInfo);
7272

73-
for (int i = 0; i < newShape.size(); i++) {
73+
for (size_t i = 0; i < newShape.size(); i++) {
7474
if (newShape[i] != newShapeView[i]) {
7575
std::string errorMessage;
7676
errorMessage += "Failed to set shape. ";

libnd4j/include/ops/declarable/helpers/cpu/nth_element.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ void nthElementFunctor_(NDArray* input, sd::LongType n, NDArray* output, bool re
5959

6060
void nthElementFunctor(sd::LaunchContext* launchContext, NDArray* input, sd::LongType n, NDArray* output,
6161
bool reverse) {
62-
BUILD_SINGLE_SELECTOR(input->dataType(), nthElementFunctor_, (input, n, output, reverse), SD_COMMON_TYPES);
62+
BUILD_SINGLE_SELECTOR(input->dataType(), nthElementFunctor_, (input, n, output, reverse), SD_NUMERIC_TYPES);
6363
}
6464
BUILD_SINGLE_TEMPLATE(template void nthElementFunctor_,
65-
(NDArray * input, sd::LongType n, NDArray* output, bool reverse), SD_COMMON_TYPES);
65+
(NDArray * input, sd::LongType n, NDArray* output, bool reverse), SD_NUMERIC_TYPES);
6666

6767
} // namespace helpers
6868
} // namespace ops

libnd4j/include/ops/declarable/helpers/impl/ctcBeam.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ void inner_beam_search(const Type* log_p, const uint64_t inc_p, IndexType* resul
391391
auto start_index = last_beams[j].index_as_parent;
392392
auto end_index = last_beams[j].index_as_parent + last_beams[j].children_count;
393393

394-
for (int c = 0; c < len_c; c++) {
394+
for (int c = 0; c < static_cast<int>(len_c); c++) {
395395
if (c == blank_index) continue;
396396

397397
const auto prob = element<HasElementStride>(log_p, c, element_stride); // log_p[c];
@@ -530,7 +530,7 @@ void inner_beam_search(const Type* log_p, const uint64_t inc_p, IndexType* resul
530530
result_prob[j] = top.prob.total;
531531
result_seq_length[j] = seq_size;
532532
// copy sequence
533-
for (auto s = 0; s < seq_size; s++) {
533+
for (size_t s = 0; s < seq_size; s++) {
534534
result_sequence[s] = result_vector[s];
535535
}
536536

libnd4j/include/ops/declarable/impl/DeclarableReductionOp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ShapeList* DeclarableReductionOp::calculateOutputShape(ShapeList* inputShape, Co
4141
auto axis = INPUT_VARIABLE(1);
4242
for (int e = 0; e < axis->lengthOf(); e++) dims.push_back(axis->e<int>(e));
4343
} else if (block.getIArguments()->size())
44-
for (int e = 0; e < block.getIArguments()->size(); e++) dims.push_back(INT_ARG(e));
44+
for (size_t e = 0; e < block.getIArguments()->size(); e++) dims.push_back(INT_ARG(e));
4545
else if (block.getAxis()->size()) {
4646
dims = *block.getAxis();
4747
}

libnd4j/include/ops/declarable/impl/LegacyBroadcastBoolOp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Status LegacyBroadcastBoolOp::validateAndExecute(Context &block) {
4141

4242
int opNum = block.opNum() < 0 ? this->_opNum : block.opNum();
4343

44-
auto packX = ConstantTadHelper::getInstance().tadForDimensions(x->shapeInfo(), &dims);
44+
auto packX = ConstantTadHelper::getInstance().tadForDimensions(x->shapeInfo(), &dims,true);
4545

4646
PointersManager manager(block.launchContext(), "LegacyBroadcastBoolOp");
4747
auto pTadShape = Environment::getInstance().isCPU()
@@ -65,7 +65,7 @@ Status LegacyBroadcastBoolOp::validateAndExecute(Context &block) {
6565
// this is rare, but possible use case - X and Z might have different shapes/strides/orders. In this case we prepare
6666
// and pass separate TAD info
6767

68-
auto packZ = ConstantTadHelper::getInstance().tadForDimensions(z->shapeInfo(), &dims);
68+
auto packZ = ConstantTadHelper::getInstance().tadForDimensions(z->shapeInfo(), &dims,true);
6969

7070
auto zTadShape = Environment::getInstance().isCPU()
7171
? packZ->primaryShapeInfo()

libnd4j/include/ops/declarable/impl/LegacyBroadcastOp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Status LegacyBroadcastOp::validateAndExecute(Context &block) {
4646

4747
int opNum = block.opNum() < 0 ? this->_opNum : block.opNum();
4848

49-
auto packX = ConstantTadHelper::getInstance().tadForDimensions(x->shapeInfo(), &dims);
49+
auto packX = ConstantTadHelper::getInstance().tadForDimensions(x->shapeInfo(), &dims,true);
5050

5151
auto tadLen = shape::length(packX->primaryShapeInfo());
5252
REQUIRE_TRUE(tadLen == y->lengthOf(), 0,
@@ -70,7 +70,7 @@ Status LegacyBroadcastOp::validateAndExecute(Context &block) {
7070
else {
7171
// this is rare, but possible use case - X and Z might have different shapes/strides/orders. In this case we prepare
7272
// and pass separate TAD info
73-
auto packZ = ConstantTadHelper::getInstance().tadForDimensions(z->shapeInfo(), &dims);
73+
auto packZ = ConstantTadHelper::getInstance().tadForDimensions(z->shapeInfo(), &dims,true);
7474

7575
auto zTadShape = Environment::getInstance().isCPU()
7676
? packZ->primaryShapeInfo()

libnd4j/include/ops/declarable/impl/LegacyIndexReduceOp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Status LegacyIndexReduceOp::validateAndExecute(Context &block) {
136136
}
137137
if (dims.size() > 1) std::sort(dims.begin(), dims.end());
138138

139-
auto tadPack = ConstantTadHelper::getInstance().tadForDimensions(x->shapeInfo(), &dims);
139+
auto tadPack = ConstantTadHelper::getInstance().tadForDimensions(x->shapeInfo(), &dims, true);
140140

141141
NativeOpExecutioner::execIndexReduce(
142142
block.launchContext(), opNum, x->buffer(), x->shapeInfo(), x->specialBuffer(), x->specialShapeInfo(),
@@ -166,7 +166,7 @@ Status LegacyIndexReduceOp::validateAndExecute(Context &block) {
166166

167167
REQUIRE_TRUE(axis.size() > 0, 0, "Some dimensions required for reduction!");
168168

169-
auto tadPack = ConstantTadHelper::getInstance().tadForDimensions(x->shapeInfo(), &axis);
169+
auto tadPack = ConstantTadHelper::getInstance().tadForDimensions(x->shapeInfo(), &axis,true);
170170

171171
NativeOpExecutioner::execIndexReduce(
172172
block.launchContext(), opNum, x->buffer(), x->shapeInfo(), x->specialBuffer(), x->specialShapeInfo(),

0 commit comments

Comments
 (0)