Skip to content

Commit

Permalink
Pass the std:min argument's type, to avoid the compilation error. (dm…
Browse files Browse the repository at this point in the history
…lc#3637)

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

* Update parallel_for.h

* Update negative_sampling.cc

Co-authored-by: Quan (Andy) Gan <[email protected]>
  • Loading branch information
kennethxian and BarclayII authored Jan 11, 2022
1 parent 37467e2 commit b002f8f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/dgl/runtime/parallel_for.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 (...) {
Expand Down
2 changes: 1 addition & 1 deletion src/array/cpu/negative_sampling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)};
}

Expand Down

0 comments on commit b002f8f

Please sign in to comment.