Unverified Commit b002f8f9 authored by MaoYuan Xian's avatar MaoYuan Xian Committed by GitHub
Browse files

Pass the std:min argument's type, to avoid the compilation error. (#3637)



* Pass the std:min argument's type, to avoid the compilation error.

* Update parallel_for.h

* Update negative_sampling.cc
Co-authored-by: default avatarQuan (Andy) Gan <coin2028@hotmail.com>
parent 37467e25
......@@ -165,7 +165,7 @@ DType parallel_reduce(
auto chunk_size = divup((end - begin), num_threads);
auto begin_tid = begin + tid * chunk_size;
if (begin_tid < end) {
auto end_tid = std::min(end, chunk_size + begin_tid);
auto end_tid = std::min(end, static_cast<size_t>(chunk_size + begin_tid));
try {
results[tid] = f(begin_tid, end_tid, ident);
} catch (...) {
......
......@@ -57,7 +57,7 @@ std::pair<IdArray, IdArray> CSRGlobalUniformNegativeSampling(
});;
end = std::unique(begin, end);
}
int64_t num_sampled = std::min(end - begin, num_samples);
int64_t num_sampled = std::min(static_cast<int64_t>(end - begin), num_samples);
return {row.CreateView({num_sampled}, row->dtype), col.CreateView({num_sampled}, col->dtype)};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment