Skip to content

Commit 94771c4

Browse files
Fix errors and warnings in asserts (#836)
* fixed typo in variable name in assertion * Fixed compiler warnings from code in assertions, comparison of signed and unsigned types
2 parents 40cdb97 + 458c4ea commit 94771c4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

dpctl/tensor/libtensor/include/utils/type_dispatch.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class DispatchTableBuilder
8080
factory<funcPtrT, dstTy, double>{}.get(),
8181
factory<funcPtrT, dstTy, std::complex<float>>{}.get(),
8282
factory<funcPtrT, dstTy, std::complex<double>>{}.get()};
83-
assert(per_dsTy.size() == _num_types);
83+
assert(per_dstTy.size() == _num_types);
8484
return per_dstTy;
8585
}
8686

dpctl/tensor/libtensor/source/tensor_py.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ void simplify_iteration_space(int &nd,
411411
}
412412
}
413413

414-
assert(simplified_shape.size() == nd);
415-
assert(simplified_src_strides.size() == nd);
416-
assert(simplified_dst_strides.size() == nd);
414+
assert(simplified_shape.size() == static_cast<size_t>(nd));
415+
assert(simplified_src_strides.size() == static_cast<size_t>(nd));
416+
assert(simplified_dst_strides.size() == static_cast<size_t>(nd));
417417
int contracted_nd = simplify_iteration_two_strides(
418418
nd, simplified_shape.data(), simplified_src_strides.data(),
419419
simplified_dst_strides.data(),
@@ -472,9 +472,9 @@ void simplify_iteration_space(int &nd,
472472
simplified_dst_strides.push_back(dst_strides[0]);
473473
}
474474

475-
assert(simplified_shape.size() == nd);
476-
assert(simplified_src_strides.size() == nd);
477-
assert(simplified_dst_strides.size() == nd);
475+
assert(simplified_shape.size() == static_cast<size_t>(nd));
476+
assert(simplified_src_strides.size() == static_cast<size_t>(nd));
477+
assert(simplified_dst_strides.size() == static_cast<size_t>(nd));
478478
}
479479
}
480480

@@ -1329,9 +1329,9 @@ void copy_numpy_ndarray_into_usm_ndarray(
13291329
simplified_shape, simplified_src_strides,
13301330
simplified_dst_strides, src_offset, dst_offset);
13311331

1332-
assert(simplified_shape.size() == nd);
1333-
assert(simplified_src_strides.size() == nd);
1334-
assert(simplified_dst_strides.size() == nd);
1332+
assert(simplified_shape.size() == static_cast<size_t>(nd));
1333+
assert(simplified_src_strides.size() == static_cast<size_t>(nd));
1334+
assert(simplified_dst_strides.size() == static_cast<size_t>(nd));
13351335

13361336
// handle nd == 0
13371337
if (nd == 0) {

0 commit comments

Comments
 (0)