Skip to content

Commit 5bcf181

Browse files
authored
fix: sample_nbrs without replacement (#648)
Signed-off-by: Parvm1102 <parvmittal31757@gmail.com>
1 parent 00ebef3 commit 5bcf181

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

GNNGraphs/src/sampling.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function sample_nbrs(loader::NeighborLoader, node::Int, layer::Int)
5858
return Int[]
5959
else
6060
num_samples = min(loader.num_neighbors[layer], length(neighbors)) # Limit to required samples for this layer
61-
return rand(neighbors, num_samples) # Randomly sample neighbors
61+
return StatsBase.sample(neighbors, num_samples; replace = false) # Randomly sample distinct neighbors
6262
end
6363
end
6464

0 commit comments

Comments
 (0)