Skip to content

Fix errors and warnings in asserts #836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dpctl/tensor/libtensor/include/utils/type_dispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class DispatchTableBuilder
factory<funcPtrT, dstTy, double>{}.get(),
factory<funcPtrT, dstTy, std::complex<float>>{}.get(),
factory<funcPtrT, dstTy, std::complex<double>>{}.get()};
assert(per_dsTy.size() == _num_types);
assert(per_dstTy.size() == _num_types);
return per_dstTy;
}

Expand Down
18 changes: 9 additions & 9 deletions dpctl/tensor/libtensor/source/tensor_py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@ void simplify_iteration_space(int &nd,
}
}

assert(simplified_shape.size() == nd);
assert(simplified_src_strides.size() == nd);
assert(simplified_dst_strides.size() == nd);
assert(simplified_shape.size() == static_cast<size_t>(nd));
assert(simplified_src_strides.size() == static_cast<size_t>(nd));
assert(simplified_dst_strides.size() == static_cast<size_t>(nd));
int contracted_nd = simplify_iteration_two_strides(
nd, simplified_shape.data(), simplified_src_strides.data(),
simplified_dst_strides.data(),
Expand Down Expand Up @@ -472,9 +472,9 @@ void simplify_iteration_space(int &nd,
simplified_dst_strides.push_back(dst_strides[0]);
}

assert(simplified_shape.size() == nd);
assert(simplified_src_strides.size() == nd);
assert(simplified_dst_strides.size() == nd);
assert(simplified_shape.size() == static_cast<size_t>(nd));
assert(simplified_src_strides.size() == static_cast<size_t>(nd));
assert(simplified_dst_strides.size() == static_cast<size_t>(nd));
}
}

Expand Down Expand Up @@ -1329,9 +1329,9 @@ void copy_numpy_ndarray_into_usm_ndarray(
simplified_shape, simplified_src_strides,
simplified_dst_strides, src_offset, dst_offset);

assert(simplified_shape.size() == nd);
assert(simplified_src_strides.size() == nd);
assert(simplified_dst_strides.size() == nd);
assert(simplified_shape.size() == static_cast<size_t>(nd));
assert(simplified_src_strides.size() == static_cast<size_t>(nd));
assert(simplified_dst_strides.size() == static_cast<size_t>(nd));

// handle nd == 0
if (nd == 0) {
Expand Down