-
Hi, I would like to perform negative sampling for a batch of edge_index1 = torch.as_tensor([[0, 0, 1, 2, 3], [0, 1, 0, 3, 2]])
edge_index2 = torch.as_tensor([[4, 6, 5], [4, 5, 6]])
edge_index = torch.cat([edge_index1, edge_index2], dim=1) # shape [2, 8]
batch = torch.as_tensor([0, 0, 0, 0, 1, 1, 1])
batched_negative_sampling(edge_index, batch, num_neg_samples=edge_index.shape[1]*2, force_undirected=True) # shape [2, 12] Results:
Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
rusty1s
Feb 15, 2024
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
vietngth
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[2, 12]
. Note that negative sampling is done without replacement, and sonum_neg_samples
only acts as an upper bound.