Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 31, 2023
1 parent cf440e8 commit 3fb34e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pyg_lib/csrc/sampler/cpu/neighbor_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,12 @@ class NeighborSampler {
// Case 2: Multinomial sampling:
else {
at::Tensor index;
if (replace) { // at::multinomial has good perfomance only when replace=true, e.g. https://github.com/pytorch/pytorch/issues/11931#top
if (replace) { // at::multinomial has good perfomance only when
// replace=true, e.g.
// https://github.com/pytorch/pytorch/issues/11931#top
index = at::multinomial(weight, count, replace);

Check warning on line 230 in pyg_lib/csrc/sampler/cpu/neighbor_kernel.cpp

View check run for this annotation

Codecov / codecov/patch

pyg_lib/csrc/sampler/cpu/neighbor_kernel.cpp#L230

Added line #L230 was not covered by tests
}
else { // An Efficient Algorithm for Biased Sampling: https://utopia.duth.gr/~pefraimi/research/data/2007EncOfAlg.pdf
} else { // An Efficient Algorithm for Biased Sampling:
// https://utopia.duth.gr/~pefraimi/research/data/2007EncOfAlg.pdf
const auto rand = at::empty_like(weight).uniform_();
const auto key = (rand.log() / weight);
index = std::get<1>(key.topk(count));
Expand Down

0 comments on commit 3fb34e9

Please sign in to comment.