mirror of
https://github.com/dmlc/dgl.git
synced 2026-06-03 19:34:33 +08:00
change based on #7462
This commit is contained in:
@@ -1412,7 +1412,7 @@ inline int64_t UniformPick(
|
||||
/** @brief An operator to perform non-uniform sampling. */
|
||||
static torch::Tensor NonUniformPickOp(
|
||||
torch::Tensor probs, int64_t fanout, bool replace) {
|
||||
auto positive_probs_indices = probs.nonzero().squeeze(1);
|
||||
auto positive_probs_indices = probs.contiguous().nonzero();
|
||||
auto num_positive_probs = positive_probs_indices.size(0);
|
||||
if (num_positive_probs == 0) return torch::empty({0}, torch::kLong);
|
||||
if ((fanout == -1) || (num_positive_probs <= fanout && !replace)) {
|
||||
|
||||
Reference in New Issue
Block a user